Text-Terminal-HOWTO: Terminal Special Files: /dev/tty... etc.
6. Terminal Special Files: /dev/tty... etc."tty" is an abbreviation for "Teletype". The first terminals were
Teletypes (like remotely controlled typewriters). See subsection Teletypes.6.1 Serial Port TerminalsThe computer considers the terminal on a serial port to be a
"device". For each such terminal there is a special file in the /dev
(device) directory. /dev/ttyS0 is the special file for the serial
port known as COM1 in the DOS/Windows world. To send text to a
terminal you may redirect standard output of some command-line command
to the appropriate special file. For example typing "echo test >/dev/ttyS1" at the command prompt should send the word "test" to the
terminal on ttyS1 (COM2) provided you have write permission on
/dev/ttyS1. Similarly, typing "cat my_file >/dev/ttyS0" will send
the contents of the file my_file to COM1 (ttyS0).In addition to ttyS0 (/dev/ttyS0), ttyS1, ttyS2, etc. (the "S" stands
for Serial port) there is also a "cua" series: cua0, cua1, cua2, etc.
cua0 is the same port as ttyS0, etc. The "cu" of cua stands for
CalloUt. The ttyS series are Posix compliant while using cua may
permit the opening of a port that the modem control lines say is not
ready. It's claimed that the cua series is only included for
backwards compatibility so you should normally use the ttyS series.
There is talk about abolishing cua since ttyS can behave just like cua
provided the programmer uses the appropriate flags in the "open"
command in an application.6.2 Pseudo TerminalsPseudo terminals have no unique physical connector on the
computer. They are used to emulate a serial port. For example, if
someone connects via telnet to your computer over a network, they may
wind up connected to the device /dev/ptyp2 (a pseudo terminal port).
In X-Windows, the terminal emulator program, xterm (or rxvt), uses
pseudo terminals. Ham radio programs under Linux also use them.
Using certain application software it is possible to have 2 or more
pseudo terminals attached to the same physical serial port.Pseudo terminals come in pairs such as ttyp3 and ptyp3. The pty... is
the master or controlling terminal and the tty... is the slave. ttyq5
is also a pseudo terminal as is ttysc (c is a hexadecimal digit).
More precisely, pseudo master terminals are /dev/pty[p-s]N
and the corresponding slaves are /dev/tty[p-s]N where N is a
hexadecimal digit.6.3 The Controlling Terminal /dev/tty/dev/tty stands for the controlling terminal (if any) for the
current process (the process that uses "/dev/tty" in a command). To
find out which tty's are attached to which processes use the "ps -a"
command at the shell prompt (command line). Look at the "tty" column.
For the shell process you're in, /dev/tty is the terminal you are now
using. Type "tty" at the shell prompt to see what it is (see manual
pg. tty(1)). /dev/tty is something like a link to the actually
terminal device name with some additional features for C-programmers:
see the manual page tty(4).6.4 /dev/ttyIN "Terminals"N stands for an integer. One use of these in Linux is with the
ISDN driver package: isdn4linux. The ttyIN is something like ttySN.
There is also a cuiN which is something like cuaN. The ttyI and cui
emulate modems and may be given modem commands.6.5 The Console: /dev/ttyNIn Linux the PC monitor is called the console and has several
device special files associated with it: tty0, tty1, tty2, etc. When
you log in you are on tty1. To go to tty2 press Alt-F2. tty1, tty2,
etc. are "virtual terminals" (sometimes called "virtual consoles").
You may log in to different virtual terminals and thus have a few
different sessions with the computer going on at the same time. You
switch between them using the Alt-F? key where "?" is the
virtual-terminal number you want. The console is also known as
/dev/tty0 and system messages may go to that device and display on
your console. Only the system or the root user may write to /dev/tty0
to which /dev/console is sometimes linked. System messages may also
be written directly to the hardware address of the console thus
bypassing /dev/tty0. For more info on the console see The Linux Console.6.6 Creating a Device with mknodThe /dev directory comes supplied with many device special files.
If you need something that's not there you may try to create it with
the "mknod" command. See the manual page ttys(4) for how to do this
for serial ports. To use mknod you must know the major and minor
device numbers. You might be able to infer the numbers you need by
using the "ls -l" command in the /dev directory. It will display
the major and minor numbers of existing special files.
c
Wyszukiwarka
Podobne podstrony:
text terminal howto 2 eco2mtullt7zlyeiszxynu2yrkoyuriolwpudhi eco2mtullt7zlyeiszxynu2yrkoyuriolwpudhtext terminal howto 1 s76m2vv53hpf7iuhhhmqyqtjzxinakzs3uz5aey s76m2vv53hpf7iuhhhmqyqtjzxinakzs3uz5aetext terminal howto 19 oh6tpsuaxvxr4hf37ciuydnfpa5d6wfzvbt6uki oh6tpsuaxvxr4hf37ciuydnfpa5d6wfzvbt6utext terminal howto 8 6oap46zh2atkgwpj6lieirkd233gx7koq7xf2ga 6oap46zh2atkgwpj6lieirkd233gx7koq7xf2gtext terminal howto 3 auzt7kasgagee6644i6bimjecd2ia4tciuo45gy auzt7kasgagee6644i6bimjecd2ia4tciuo45gtext terminal howto kpze5eddlh3abi7dfltb7z3zwyd5zfxcg5hb7ba kpze5eddlh3abi7dfltb7z3zwyd5zfxcg5hb7batext terminal howto 10 6xnqiwoqqg63dbxziffmdaxaql7crul6m6jfgaq 6xnqiwoqqg63dbxziffmdaxaql7crul6m6jfgtext terminal howto 15 dvswdfv63wzarnnqikomdtizprofgvdxi47mlja dvswdfv63wzarnnqikomdtizprofgvdxi47mltext terminal howto 20 opfgcqrq54z7jifn7jscwd7frxsxzhcyohognaq opfgcqrq54z7jifn7jscwd7frxsxzhcyohogntext terminal howto 7 d3zeov4eq2brkq3rwyrf3gmfrujvxtharzotlcq d3zeov4eq2brkq3rwyrf3gmfrujvxtharzotlctext terminal howto 22 ubalhv6pmumdby22mufhx3ivbqploo4mucmyina ubalhv6pmumdby22mufhx3ivbqploo4mucmyitext terminal howto 5 z4nav75xpqiwzwonw4msjdpqapgpjb36mwdb5xa z4nav75xpqiwzwonw4msjdpqapgpjb36mwdb5xtext terminal howto 4 zm272gurucsnas4ng5zewrpsucz5ovzrqdakfvq zm272gurucsnas4ng5zewrpsucz5ovzrqdakfvtext terminal howto 4 zm272gurucsnas4ng5zewrpsucz5ovzrqdakfvq zm272gurucsnas4ng5zewrpsucz5ovzrqdakfvtext terminal howto 12 mnwbjvagxa5xkhk42ctoc5geqwdjewwanqsav4y mnwbjvagxa5xkhk42ctoc5geqwdjewwanqsavtext terminal howto 9 kindkpoux7ukzlglfzssjv3kq3kzkgsrqe7aeei kindkpoux7ukzlglfzssjv3kq3kzkgsrqe7aeebootdisk howto pl 8java text FieldPositionPPP HOWTO pl 6 (2)więcej podobnych podstron