Linux |
||
/dev
I think one of the most important components but the most confusing/mysterious things in linux would be those in /dev. This directly contains all the devices (device drivers) that can be connected to the computer.
/dev/sd - sda, sdb,... sda1, sda2,...
if you try 'ls /dev/sd*', you will get all the device list starting with 'sd'. What does sd mean ? It means 'storage device' and 'sd' originally indicated 'SCSI (Small Computer System Interface)', however, as more and more other types of storage devices, it has become indicate various other devices as well, SATA(Serial AT Attachement) and usb etc.
However, if you try 'ls /dev/sd*', you would mostly get 'sda', 'sdb' etc.. what does 'a', 'b' etc stands for ? It is the order of storage device that the linux finds as example below. sda : the first device (in most case, this will indicate the primary harddisk on your computer) sdb : the second device etc
Also you would see a number followed by these device like sda1, sda2 etc. what does this number indicates ? it indicates the partition number, so sda1, sda2, sdb1 means as follows. sda1 : the first partion on the first storage device sda2 : the second partion on the first storage device sdb1 : the first partion on the second storage device
/dev/tty
tty is a kind of serial ports (like COM port on Windows) and are mostly used for use input like keyboard etc.
< Listing Up all the tty on your system >
you can list up all the tty drivers in /dev as follows.
$ ls -al /dev/tty*
crw-rw-rw- 1 root tty 5, 0 Jan 22 13:09 /dev/tty crw--w---- 1 root tty 4, 0 Jan 21 16:56 /dev/tty0 crw--w---- 1 root tty 4, 1 Jan 21 16:56 /dev/tty1 ... crw--w---- 1 root tty 4, 2 Jan 21 16:56 /dev/tty2 crw--w---- 1 root tty 4, 20 Jan 21 16:56 /dev/tty20 ... crw--w---- 1 root tty 4, 3 Jan 21 16:56 /dev/tty3 crw--w---- 1 root tty 4, 30 Jan 21 16:56 /dev/tty30 ... crw--w---- 1 root tty 4, 4 Jan 21 16:56 /dev/tty4 crw--w---- 1 root tty 4, 40 Jan 21 16:56 /dev/tty40 ... crw--w---- 1 root tty 4, 5 Jan 21 16:56 /dev/tty5 crw--w---- 1 root tty 4, 50 Jan 21 16:56 /dev/tty50 ... crw--w---- 1 root tty 4, 6 Jan 21 16:56 /dev/tty6 crw--w---- 1 root tty 4, 60 Jan 21 16:56 /dev/tty60 ... crw--w---- 1 root tty 4, 7 Jan 21 16:56 /dev/tty7 crw--w---- 1 root tty 4, 8 Jan 21 16:56 /dev/tty8 crw--w---- 1 root tty 4, 9 Jan 21 16:56 /dev/tty9 crw------- 1 root root 5, 3 Jan 21 16:56 /dev/ttyprintk crw-rw---- 1 root dialout 4, 64 Jan 21 16:56 /dev/ttyS0 crw-rw---- 1 root dialout 4, 65 Jan 21 16:56 /dev/ttyS1 crw-rw---- 1 root dialout 4, 74 Jan 21 16:56 /dev/ttyS10 ... crw-rw---- 1 root dialout 4, 66 Jan 21 16:56 /dev/ttyS2 crw-rw---- 1 root dialout 4, 84 Jan 21 16:56 /dev/ttyS20 ... crw-rw---- 1 root dialout 4, 67 Jan 21 16:56 /dev/ttyS3 crw-rw---- 1 root dialout 4, 94 Jan 21 16:56 /dev/ttyS30 crw-rw---- 1 root dialout 4, 95 Jan 21 16:56 /dev/ttyS31 crw-rw---- 1 root dialout 4, 68 Jan 21 16:56 /dev/ttyS4 crw-rw---- 1 root dialout 4, 69 Jan 21 16:56 /dev/ttyS5 crw-rw---- 1 root dialout 4, 70 Jan 21 16:56 /dev/ttyS6 crw-rw---- 1 root dialout 4, 71 Jan 21 16:56 /dev/ttyS7 crw-rw---- 1 root dialout 4, 72 Jan 21 16:56 /dev/ttyS8 crw-rw---- 1 root dialout 4, 73 Jan 21 16:56 /dev/ttyS9
< Printing out the details of a tty configuration >
you can check the detailed configuration of a tty using following command.
$ stty -a < /dev/tty
speed 38400 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
< Finding out which tty is used for a terminal >
One of the most common usage of tty is to take in the input and print out some output through command prompt (consol). Whenever you open a terminal a tty is assigned to the terminal. You can figure out which tty is assigned to a specific terminal you opened by tty command as shown below. You see 'pts' at the result. pts is a kind of software tty.
< Printing an output to a different terminal using tty >
|
||