Linux endpoint concepts and related commands

Source: Internet
Author: User

The concept of terminal in Linux:

In the process of using the Linux operating system, we can use the terminal (terminal) to enter the command and receive information, if the user wants to interact with the computer, it will be used to the terminal, so that the display and keyboard is a terminal, we receive the display output information, through the keyboard input information to the computer, Displays and keyboards are real physical devices that we can call physical terminals.

Just mentioned physical terminal, in addition to physical terminal, there are virtual terminal, graphics terminal, analog terminal and other terminal types.

     Virtual Terminal: Virtual Terminal is based on the physical terminal, the virtual implementation of the terminal, virtual terminal is called TTY, we can virtual terminal on the same physical terminal, CENTOS6 in the default has 6 virtual terminal, we use CTRL+ALT+FX (F1, F2 F6) shortcut keys in these 6 virtual terminals switch between, all the files in Linux, these virtual terminal abstract text file name is called/dev/tty#  , virtual terminal can only be used on the physical host, If remote to the host through Remote tools (for example, via Xshell or VNC remote), you cannot switch to the virtual terminal via the shortcut key.

     Graphics Terminal: The graphics terminal belongs to one of the above virtual terminal, so it is based on the physical terminal, in the way of software virtual, but it also provides a desktop environment, if start CENTOS6 using graphical start, see graphical desktop, press CTRL+ALT+F2, will switch to CentOS second virtual terminal, this virtual terminal is a character interface virtual terminal, in the second virtual terminal, Press CTRL+ALT+F1, will go back to the graphical interface, where the graphical interface and the second virtual terminal is what we are talking about the 6 virtual terminal in CentOS, but the first virtual terminal is a graphics terminal, but also virtual terminal tty1.

Analog Terminal: We can understand the analog terminal as a program, this program is a terminal simulator, the terminal simulator is called Analog Terminal, also known as PTS, graphical start CENTOS6, in the desktop blank right-click, stand-alone Open in Ternimal, You can open a command-line window that is an analog terminal. Or we use the remote SSH program to reverse the command line interface is also an analog terminal, analog terminal file/dev/pts/#.


Terminal-related commands:

Who command

use the WHO command to see how many endpoints are currently connected to the server.    

[[email protected] ~]# whoroot      tty2         2016-07-23 13:40root      tty1         2016-07-23 13:34  (: 0) root      pts/0        2016-07-23 13:34  (: 0.0) root     pts/1        2016-07-23  14:38  (192.168.131.1) 

from the results we can see that four terminals are logged in by the root user, Tty2 is my According to the virtual terminal called by Ctrl+alt+f2, Tty1 is the graphical interface (graphics terminal) which is entered by default after the system starts, pts/0 is the analog terminal which I open from the GUI right-click menu, PTS/1 is the analog terminal which I opened by Xshell this SSH tool.


not used who command, type only w , who command returned.

[[email protected] ~]# w 17:27:40 up  3:54,  3 users,   load average: 0.59, 0.22, 0.10USER     TTY       FROM               [email protected]   idle   jcpu   pcpu whatroot      tty1     :0                13:34    3:53m 10.41s 10.41s  /usr/bin/Xorg :0 -br -verbose -audit 4 -auroot      pts/0    :0.0              13:34   57:00   0.24s  0.24s /bin/bashroot      pts/1    192.168.131.1    14:38    0.00s  0.31s   0.06s w



Who am I command or TTY command

Use the Who am I command to see which terminal is currently in use

[[email protected] ~]# who am iroot pts/1 2016-07-23 14:38 (192.168.131.1)

Because I typed the Who am I command in the SSH tool, the returned results show that I am currently using the type of PTS, the terminal number is PTS/1, and I also return the logon time of this terminal and my client IP.


You can also view the current terminal using the TTY command

[Email protected] ~]# TTY/DEV/PTS/1



CHVT command

Using the CHVT command to switch between virtual terminals, CHVT can be seen as an abbreviation for the change virtual terminal, so CHVT can only switch between each virtual terminal and not switch between PTS and TTY. So do not execute the CHVT command in the SSH remote tool or execute the CHVT command in the VNC display interface, because the SSH remote tool and the VNC Remote tool open terminal are the PTS type of analog terminal.

If we use CTRL+ALT+F2 shortcut key opens the second virtual Terminal (Tty2), and uses ctrl+alt+f3 opened the third virtual terminal (TTY3) , plus the Graphical interface (TTY1) entered by default after system startup.

So, we can open a command line terminal (analog terminal) in the graphical interface, and then enter the following command in the analog terminal from graphical interface (tty1) switch to third virtual terminal (TTY3).

[Email protected] ~]# CHVT 3

In the graphical command line, after the execution of CHVT3, should have switched to tty3, we in the current tty3 input CHVT 1 can be switched to the graphical interface (graphics virtual terminal).




Marco Education Linux Learning notes

http://www.magedu.com/



.

This article is from the "School of Thought" blog, please be sure to keep this source http://zz6547.blog.51cto.com/2571551/1829111

Linux endpoint concepts and related commands

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.