Linux terminal type and mutual conversion mode __linux

Source: Internet
Author: User
Tags network function

The terminals in Linux system are basically in the/dev directory, which can be divided into text command line mode and graphical interface mode. The graphical interface in the Windows system is in the system kernel space, and the graphical interface in the Linux system is invoked as an application, so the graphical interface in the Windows system starts up, and the graphical interface in the Linux system can not boot. Because it's equivalent to an application running on a Linux system.

In CentOS and Redhat, you can change the startup items by modifying the Id:3:initdefault in the/etc/inittab file. If the ID is 3, the text command terminal mode is started, and the 3 change to 5 will start the graphical interface (i.e. Xwindow) mode by default. Inittab is a text file that is not executable and is called by the INIT initialization process after Linux completes the kernel boot and is a configuration file. The ID in the file is formatted as: id:run-level:action:process, separated by a colon, some of which are nullable, and the Inittab file in my CENTOS6 system has only the first 3 items in it, and the process is empty. The ID identifier is unique and cannot be duplicated in the configuration file. RUN-LEVEL Specifies the system run level, and you can see the explanation shown in the following figure when you view the file by Vi/etc/inittab:

Divided into 7 levels (0~6):

0-halt, that is, shutdown, so when the shutdown can also be executed through the Init 0 instructions, but this is a direct shutdown, will not prompt, it is recommended that users do not use this.

1-single-user mode. Single-user mode is only accessible to system administrators, and administrators can handle files in this mode that cannot be changed without a login user. Number 1 can also be substituted with S.

2-Multi-user text command-line mode that does not have network file system capabilities. Less used.

3-Multi-user text command line mode with network file system capabilities. is the most common operating mode and the default mode for most servers.

4-Keep not.

5-Have the network function Xwindow mode, the beginner may set it as the default mode, the system initializes directly enters the graphical interface, the operation is more convenient, is suitable for the beginner, but for the commonly used Linux user This is not a very good choice, or should use 3 mode.

6-Close all running processes and reboot the system.

Action is the action that runs, Initdefault is the execution level entered after the system starts, and the line does not need to specify a process.

If the mode starts with the Run-level 3 text command-line mode, you can switch to the 5 Xwindow mode after the login command startx, using StartX--1 to open the second Xwindow. In Xwindow mode, you can go back to command line mode by ctrl+alt+ (F1~F6). F1~F6 represents 6 consoles. StartX can only be used when Xwindow is not started, if Xwindow has been started and then returned to command line mode, then if you want to go back to the Xwindow you have already started, you will not be able to use STARTX, you need to use Ctrl+alt+f7/f8, This represents two Xwindow consoles. Switch between command line consoles through ALT+FN, such as switching from command line console 1 to console 5, you can perform alt+f5. These commands work correctly under the real machine, but if the Linux system is in the VM virtual machine, there is a problem, because Ctrl+alt has been used as a shortcut by the VM, so it will conflict. At this point can switch through CTRL+ALT+SHIFT+FN, if this is not enough, you can hold down the Ctrl+alt, and then press the Space key, and then release the Space key, and then press the FN key to complete the switch, I am in my VM virtual Machine CENTOS6 system experiment, can switch normally.

In Linux,/dev/ttyn represents the console terminal, which is the text command line terminal mentioned above, which can be switched by ALT+FN. When landing on the console, using the Tty1, then the WHO command can be used to view the tty1 has a user login:

At this point again open a text console terminal and landing, there will be tty2 used, and so on, TTY can generally support 6, and Tty1~tty6. TTY0 represents the virtual terminal currently in use, the information generated by the system is sent to this terminal, which is equivalent to an alias for the currently used terminal, for example, if Tty3 is currently in use, then Tty0 represents Tty3. Only the root user can write to/dev/tty0. For example, the test message can be sent to the currently used terminal by Ech0 "Test" >/dev/tty0, but if the root user does not prompt permission denied.

The above figure also has 3 pts terminals, on my machine, pts/0 and PTS/2 are two Xwindow consoles, PTS/1 is the Xshell terminal that is logged in via SSH. The following information appears at this point through the ls/dev/pts view:

PTS is the realization of Pty, and PTMX with the use of Pty, and Pty is the virtual terminal, that is, pseudo terminal. Pty is a pair of logical terminals, the master and slave devices, and operations on master are reflected on the slave. They are not directly related to the actual physical device. If a program regards PTYP3 (master device) as a serial port device, its read/write operation to that port is reflected on the other TTYP3 (slave device) corresponding to that logical terminal. TTYP3 is a logical device that another program uses for read and write operations.

        Linux also has a terminal called Serial terminal, that is,/dev/ttysn. These terminals are terminal devices that are connected using a computer serial port and correspond to the COM1~COMN under the DOS system. For example, performing echo Test >/DEV/TTYS1 sends word test to a device attached to the ttyS1 port.        Finally, all processes of the XXX console can be cleared by performing skill-9 xxx. For example, skill-9/dev/pts/0 clears all processes from the first Xwindow console.

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.