Basic concepts:
TTY (general designation of terminal equipment):
The word TTY originated from teletypes, originally refers to the telex, is through the serial line with the printer keyboard to read and send information, and later this thing was replaced by keyboard and monitor, so now called terminal is more appropriate.
A terminal is a character-type device, usually used as a TTY to refer to various types of terminal equipment.
Pty(virtual terminal):
Remote Telnet to the host does not also require a terminal interaction. Yes, this is Virtual Terminal pty (Pseudo-tty)
Virtual terminal is a pair of logical terminal equipment, including master and slave devices.
pts (pseudo-terminal slave) is a way to implement Pty, and PTMX (Pseudo-terminal Master) is implemented in conjunction with the implementation pty
Serial port terminal (/dev/ttysn)
Terminal equipment connected using a computer serial port, corresponding device name similar to/DEV/TTYS0 (or/dev/tts/0),/dev/ttys1 (or/DEV/TTS/1), etc.
When you log on to the Linux system through Ssh,telnet, you will generate a device that PTS represents a virtual terminal.
Or a serial port connection, it is/dev/ttysn such as terminal equipment.
The following are commonly used commands:
1. List the users currently logged on to the system
W.H.O.
root@ubuntu:/# who
root pts/0 2017-03-01 09:51 (192.168.3.151)
root pts/1 2017-03-01 18:27 (192.168.3.129)
Root pts/2 2017-03-01 18:27 (192.168.3.144)
root pts/3 2017-03-01 18:27 (192.168.3.151)
2. Close a user who is logged on to the system
Fuser-k/dev/pts/User ID
root@ubuntu:/# fuser-k/dev/pts/3
/dev/pts/3: 9339
3. View the currently logged-on user
Tty
root@ubuntu:/# TTY
/DEV/PTS/1