CentOS terminal types and mutual conversion methods

Source: Internet
Author: User
Linux terminals are basically in the/dev directory and can be divided into the text command line mode and graphical interface mode. The graphic interface in Windows is in the system kernel space, while the graphic interface in Linux is called as an application. Therefore, the graphic interface in windows is started upon startup, the graphic interface in Linux can be started without being started, because it is equivalent to an application running on Linux. CentOS and RedH

Linux terminals are basically in the/dev directory and can be divided into the text command line mode and graphical interface mode. The graphic interface in Windows is in the system kernel space, while the graphic interface in Linux is called as an application. Therefore, the graphic interface in windows is started upon startup, the graphic interface in Linux can be started without being started, because it is equivalent to an application running on Linux.

In CentOS and RedHat, you can change the startup item by modifying the id: 3: initdefault in the/etc/inittab file. If id is 3, the terminal mode of the text command is started. if id 3 is changed to 5, the graphic interface (Xwindow) mode is started by default. Inittab is an unexecutable text file. it is called by the init initialization process after Linux completes kernel boot. it is a configuration file. The format of the id in the file is: id: run-level: action: process. each item is separated by a colon. some of the items can be empty, the inittab file in my Centos6 system has only the first three items, and the process is empty. The id is unique and cannot be repeated in the configuration file. Run-level specifies the system running level. you can see the following explanation when viewing the file through vi/etc/inittab:

There are 7 levels in total (0 ~ 6 ):

0-halt, that is, shutdown. Therefore, you can run the init 0 command during shutdown. However, this command is directly shut down and will not be prompted. we recommend that you do not use this command for multiple users.

1-single user mode. In single-user mode, only the system administrator can access the system. In this mode, the administrator can process files that cannot be changed when a user logs on to the system. ID 1 can also be replaced by s.

2-multi-user text command line mode that does not have network file system functions. It is rarely used.

3-multi-user text command line mode with network file system functions. Is the most common running mode and the default mode for most servers.

4-reserved.

5-Xwindow mode with network functions. beginners can set it to the default mode and directly enter the graphical interface during system initialization. this mode is convenient for beginners, however, this is not a good choice for users who often use Linux. you should use the 3 mode.

6-shut down all running processes and restart the system.

Action is the running Action, and initdefault is the execution level entered after the system is started. process does not need to be specified for this row.

If the mode starts the text command line mode with run-level 3, you can run the startx command to switch to the Xwindow mode of 5 after logging on, and use startx --: 1 to open the second Xwindow. In Xwindow mode, you can use Ctrl + Alt + (F1 ~ F6) then return to the command line mode. F1 ~ F6 indicates six consoles. Startx can only be used when xwindow has not been started. if xwindow has been started, and then return to command line mode, startx cannot be used if you want to return to the xwindow that has already been started, ctrl + Alt + F7/F8 is required, which represents two xwindow consoles. You can switch between the command line console through Alt + Fn. for example, if you switch from command line console 1 to console 5, you can run Alt + F5. These commands can be executed normally on a real machine. However, if the command is run on a Linux system in the vmvm, the problem may occur because Ctrl + Alt has been used as a shortcut key by the VM, causing a conflict. At this time, you can switch through Ctrl + Alt + Shift + Fn. if not, you can press Ctrl + Alt, then press the Space key, and then open the Space key, then press the Fn key to complete the switchover. I have experimented with the Centos6 system of my vmmachine and can switch normally.

In Linux,/dev/ttyn indicates the console terminal, that is, the text command line terminal mentioned above, which can be switched through Alt + Fn. When logging on to the console, tty1 is used. you can use the who command to check whether tty1 has been logged on to the console:

In this case, open a text console terminal and log on to tty2, and so on. generally, tty supports 6 tty1 and tty1 ~ Tty6. Tty0 indicates the current virtual terminal. the information generated by the system will be sent to this terminal, which is equivalent to an alias of the current terminal. for example, if tty3 is being used, tty0 indicates tty3. Only root users can write data to/dev/tty0. For example, you can use ech0 "test">/dev/tty0 to send the test message to the currently used Terminal. However, if it is not the root user, the system will prompt permission denied.

In the figure above, there are three pts terminals. on my machine, pts/0 and pts/2 are two xwindow consoles, and pts/1 is an Xshell terminal that logs on through SSH. In this case, the following information is displayed when you use ls/dev/pts:

Pts is the implementation method of pty. it is used with ptmx to implement pty, while pty is a virtual terminal, that is, a pseudo terminal. Pty is a pair of logical terminal devices, namely the master and slave devices. operations on the master are reflected on the slave. They are not directly related to physical devices. If a program regards ptyp3 (master device) as a serial port device, the read/write operations on the port are reflected in another ttyp3 (slave device) corresponding to the logical terminal device. Ttyp3 is the logical device used by another program for read/write operations.

In Linux, there is also a terminal called a serial port terminal, namely/dev/ttySn. These terminals are terminal devices connected using computer serial ports, corresponding to the COM1 ~ COMn. For example, executing echo test>/dev/ttyS1 sends the word test to the device connected to the ttyS1 port.

Finally, run skill-9 xxx to clear all processes on the xxx console. For example, skill-9/dev/pts/0 clears all processes in the first xwindow console.
Related Article

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.