Chpt 2: Devices, Disks, Filesystems and the Kernel Flashcards
What /var/ directory name stands for?
“variable”: programs record runtime information in it (like caches, system logging, etc.)
What is stored in /opt/ directory?
“optional”? May contain additional third-party software.
/usr/local dest
Admins can install their own software into it.
/usr/share dest
Contains files that should work on other kinds of Unix machines with no loss of functionality.
That’s the theory, anyway; a true share directory is becoming rare because there are no space issues
on modern disks. It is often more of a pain to maintain a share directory than it’s worth. In any case,
man, info, and some other subdirectories are often found here.
/usr/X11R6 dest
Holds the core Linux windowing system software, called XFree86. However, the custom
configuration files for your computer are usually in /etc/X11.
How to identify a device type in /dev/?
Run ls -l in it, it will show a string with devices listed. First character in permission string identifies devices. (b/c/p/s)
block device
Programs access data in a block device in fixed chunks. The hdb1 in the preceding
example is a disk device. Because disks break down into blocks of data, it is only natural that a disk
be a block device. A block device’s total size is fixed, and a program has random access to any block
in the device.
character device
eCharacter devices work with data streams. You can only read characters from or
write characters to these devices, like /dev/null in the previous example. Character devices don’t
have a size; when you read from or write to a character device, the kernel usually performs a read or
write operation on the device, leaving no record of the activity inside the kernel. Printers are character
devices, and after the kernel sends data to a printer, the responsibility for that data passes to the
printer; the kernel cannot back up and reexamine the data stream.
pipe device
Named pipes are like character devices, but there is another process at the other end of
the I/O stream instead of a kernel driver. An example of such a process is gpm, a program that can
duplicate mouse events and send them to the named pipe /dev/gpmdata for use by other programs.
Socket device
Sockets are special-purpose I/O files offering a type of network interface.
How dd command works and what it does?
Reblocks block devices. What does – add later.
Where to find hard disks listed on your system?
/dev/hd* (ATA/IDE disks and partitions)
“device without a number is an entire disks, with numbers are partitions” // really?
Where to find SCSI disks listed on your system?
SCSI disks carry the names /dev/sda, /dev/sdb, and so on, and the disks work much like their ATA
counterparts, although the SCSI disk names do not directly correspond to a SCSI host controller and
target. Linux assigns the devices in the order that it encounters the disks.
/dev/tty, /dev/pts
Terminals are devices for moving characters between the system and an I/O device, usually for text output
to a terminal screen. The terminal device interface goes back a long way, to the days when terminals were
typewriter-based devices.
Pseudo-terminal devices are emulated terminals that understand the I/O features of real terminals, but
rather than talk to a real piece of hardware, the kernel presents the I/O interface to a piece of software,
such as a shell window.
Two common terminal devices are /dev/tty1 (the first virtual console) and /dev/pts/0 (the first
pseudo-terminal device).
The /dev/tty device is the controlling terminal of the current process. If a program is currently reading
from and writing to a terminal, this device is a synonym for that terminal. A proccess does not need to be
attached to a terminal.
What are /dev/ttyS* devices?
Serial ports are special terminal devices. You can’t do much on the command line with serial port devices
because there are too many settings to worry about, such as baud rate and flow control.
The port known as COM1 on Windows is /dev/ttyS0, COM2 is /dev/ttyS1, and so on.