Linux/dev Table of Contents detailed

Source: Internet
Author: User

Under Linux, the/dev directory is important and the various devices are below. Here's a brief summary:

DEV is the acronym for Devices./dev This directory is important for all users. Because this directory contains all the external devices that are used in Linux systems . But this is not the driver for the external device , This is not the same as the Window,dos operating system . It is actually a port that accesses these external devices . we can easily access these external devices, and access a file, a directory without any distinction.

Linux inherits the Unix style, recognizing all devices as a file.

Here are some special devices:

Linux terminal, console, Tty,pty and other concepts

1>tty (collectively known as terminal equipment)

The word "TTY" originates from Teletypes, which originally refers to a telex typewriter, which is a device that reads and sends information through a serial line using a printer keyboard, which is later replaced by a keyboard and a display, so it is now more appropriate to call the terminal.

A terminal is a type of character device that has many types, usually using a TTY for short-range end devices.

2>pty (pseudo terminal, virtual terminal)

But does it require a terminal interaction if we telnet to the host remotely or use xterm? Yes, this is the Virtual Terminal Pty (Pseudo-tty)

3>PTS/PTMX (PTS/PTMX combined to achieve pty)

PTS (pseudo-terminal Slave) is an implementation of Pty, implemented Pseudo-terminal with PTMX (Pty Master).

In the Linux system device special file directory/dev/, terminal Special equipment files generally have the following:
1. Serial port terminal (/DEV/TTYSN)
The serial port terminal (Serial Port Terminal) is a terminal device connected using a computer serial port. The computer sees each serial port as a character device. For a while these serial port devices are often referred to as end-device, because it is used to connect the terminal at that time. The serial port corresponding to the device name is/dev/tts/0 (or/DEV/TTYS0),/DEV/TTS/1 (or/dev/ttys1), etc., the device number is (4,0), (4,1), respectively, corresponding to the DOS system COM1, COM2 and so on. To send data to a port, you can redirect standard output to these special file names on the command line. For example, at the command-line prompt, type: EchoTest>/dev/ttys1 will send the word "test" to the device connected to the TtyS1 (COM2) port.
2. Pseudo Terminal (/dev/pty/)
Pseudo-terminal (Pseudo Terminal) is a paired logical terminal device (that is, the master and slave devices, the operation of Master will be reflected on the slave).
For example,/DEV/PTYP3 and/DEV/TTYP3 (or/dev/pty/m3 and/DEV/PTY/S3 in the device file system). They are not directly related to the actual physical device. If a program considers PTYP3 (master device) as a serial port device, its read/write operation on that port is reflected on the other TTYP3 (slave device) corresponding to the logical terminal. The TTYP3 is a logical device that another program uses for read and write operations. Telnet Host A is to communicate with host A's login program through "Pseudo Terminal".
3. Control Terminal (/dev/tty)
If the current process has a control terminal (controlling Terminal), then/dev/tty is the device special file for the control terminal of the current process. You can use the command "Ps–ax" to see which control terminal the process is connected to. For your logged-onShell,/dev/tty is the terminal you use, the device number is (5,0). Use the command "TTY" to see which actual terminal device it corresponds to. The/dev/tty is similar to a connection to a terminal device that is actually used.
4. Console Terminal (/dev/ttyn,/dev/console)
In Linux systems, computer monitors are often referred to as console terminals (Console)。 It simulates a type of Linux terminal (Term=linux), and there are some device special files associated with it: Tty0, Tty1, Tty2, and so on. When you log in on the console, you are using Tty1. When using ALT+[F1-F6], we can switch to Tty2, Tty3, and so on. Tty1–tty6, such as virtual terminal, and Tty0 is the current use of the virtual terminal alias, the information generated by the system will be sent to the terminal (also known as Console terminal). Therefore, regardless of which virtual terminal is currently in use, the system information is sent to the console terminal. /dev/console is the console, which is the device that interacts with the operating system, and the system outputs some information directly to the console. Users are currently allowed to log in to the console only in single-user mode.
5 Virtual terminal (/dev/pts/n)
Pseudo terminal in Xwindows mode. If I use Konsole under Kubuntu, I use the virtual terminal, and I can see/DEV/PTS/1 with the TTY command.
6otherType
The Linux system also has many other kinds of terminal equipment special files for many different character devices. For example,/dev/ttyin terminal equipment for ISDN devices. Don't repeat it here.

TTY devices include virtual consoles, serial ports, and pseudo-terminal units.
/dev/tty represents the current TTY device and enters echo "Hello" >/dev/tty in the current terminal, which is displayed directly in the current terminal.

Linux/dev Directory detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.