- 一、命令 `who or w` 可以显示有哪些终端登录
- 二、命令 `who am i` 用来显示当前终端是哪一个
- 三、命令 `tty` 显示当前终端的设备文件
- 四、命令 `chvt` 用来切换虚拟终端
- 五、命令 `last` 显示每个终端的登录时间和持续时间等信息
- 六、命令 `toe -a` 列出系统支持的所有终端类型
- 七、命令infocmp来比较两个终端的区别
[root@htlwk0001host ~]# w 17:37:33 up 425 days, 7:35, 4 users, load average: 0.00, 0.01, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 - 238月20 153days 0.01s 0.01s -bash root pts/0 112.50.131.179 09:55 1.00s 0.02s 0.00s w root tty3 - 022月21 261days 0.48s 0.48s -bash root tty2 - 022月21 261days 0.01s 0.01s -bash [root@htlwk0001host ~]# who root tty1 2020-08-23 10:20 root pts/0 2021-10-22 09:55 (112.50.131.179) root tty3 2021-02-02 18:08 root tty2 2021-02-02 21:01二、命令 who am i 用来显示当前终端是哪一个
[root@htlwk0001host ~]# who am i root pts/0 2021-10-22 09:55 (112.50.131.179)三、命令 tty 显示当前终端的设备文件
[root@htlwk0001host ~]# tty /dev/pts/0
注:终端都会被抽象成操作系统中的某个文件。
四、命令 chvt 用来切换虚拟终端chvt 2 等同于 Ctrl + Alt + F2 快捷键,注意:在图形界面不行。
五、命令 last 显示每个终端的登录时间和持续时间等信息[root@htlwk0001host ~]# last root pts/0 112.50.131.179 Fri Oct 22 09:55 still logged in root pts/0 112.50.84.94 Thu Oct 21 13:47 - 20:33 (06:45) root pts/0 112.50.84.94 Tue Oct 19 15:59 - 22:00 (06:01) root pts/1 112.50.84.94 Sun Oct 17 11:26 - 23:43 (12:17) root pts/0 112.50.84.94 Sun Oct 17 10:56 - 23:43 (12:47) root pts/1 112.50.84.94 Sat Oct 16 15:10 - 23:21 (08:11) root pts/0 112.50.84.94 Sat Oct 16 15:03 - 23:23 (08:19) root pts/1 112.50.84.94 Fri Oct 15 10:54 - 00:04 (13:09) root pts/0 112.50.84.94 Fri Oct 15 08:18 - 21:17 (12:58)六、命令 toe -a 列出系统支持的所有终端类型
[root@htlwk0001host ~]# toe -a Eterm-256color Eterm with xterm 256-colors Eterm-88color Eterm with 88 colors Eterm Eterm with xterm-style color support (X Window System) ansi ansi/pc-term compatible with color aterm AfterStep terminal bterm bogl virtual terminal cygwin ANSI emulation for Cygwin cons25 freebsd console (25-line ansi mode) dumb 80-column dumb tty eterm gnu emacs term.el terminal emulation eterm-color Emacs term.el terminal emulator term-protocol-version 0.96 gnome GNOME Terminal gnome-256color GNOME Terminal with xterm 256-colors hurd The GNU Hurd console server konsole KDE console window konsole-256color KDE console window with xterm 256-colors kon Kanji ON Linux console linux linux console mach Mach Console mach-bold Mach Console with bold instead of underline mach-color Mach Console with ANSI color mach-gnu GNU Mach mach-gnu-color Mach Console with ANSI color mlterm multi lingual terminal emulator mrxvt multitabbed rxvt nsterm AppKit Terminal.app pcansi ibm-pc terminal programs claiming to be ansi putty PuTTY terminal emulator putty-256color PuTTY 0.58 with xterm 256-colors rxvt rxvt terminal emulator (X Window System) rxvt-16color rxvt with 16 colors like aixterm rxvt-256color rxvt 2.7.9 with xterm 256-colors rxvt-88color rxvt 2.7.9 with xterm 88-colors rxvt-basic rxvt terminal base (X Window System) rxvt-color rxvt terminal emulator (X Window System) rxvt-cygwin rxvt terminal emulator (X Window System) on cygwin rxvt-cygwin-native rxvt terminal emulator (native MS Window System port) on cygwin rxvt-unicode rxvt-unicode terminal (X Window System) rxvt-xpm rxvt terminal emulator (X Window System) screen VT 100/ANSI X3.64 virtual terminal screen-16color GNU Screen with 16 colors screen-256color GNU Screen with 256 colors screen.Eterm screen in Eterm screen.gnome screen in GNOME Terminal screen.konsole screen in KDE console window screen.konsole-256color GNU Screen with konsole using 256 colors screen.linux screen in linux console screen.mlterm screen in mlterm screen.mlterm-256color GNU Screen with mlterm using 256 colors screen.mrxvt screen in mrxvt screen.putty screen in putty screen.putty-256color GNU Screen with putty using 256 colors screen.rxvt screen in rxvt screen.teraterm disable ncv in teraterm screen.vte screen in any VTE-based terminal screen.vte-256color GNU Screen with vte using 256 colors screen.xterm-256color GNU Screen with xterm using 256 colors screen.xterm-r6 screen customized for X11R6 xterm screen.xterm-xfree86 screen customized for modern xterm st simpleterm st-16color simpleterm with 16-colors st-256color simpleterm with 256 colors sun Sun Microsystems Inc. workstation console teraterm Tera Term teraterm2.3 Tera Term Pro tmux tmux terminal multiplexer tmux-256color tmux with 256 colors vt100-nav vt100 without advanced video option vt102 dec vt102 vt52 dec vt52 vte VTE aka GNOME Terminal vte-256color VTE with xterm 256-colors vwmterm (vwm term) vt100 dec vt100 (w/advanced video) vt220 dec vt220 wsvt25 NetBSD wscons in 25 line DEC VT220 mode wsvt25m NetBSD wscons in 25 line DEC VT220 mode with meta xfce Xfce Terminal xterm xterm terminal emulator (X Window System) xterm-1002 xterm any-event mouse xterm-1003 testing xterm-mouse xterm-1005 xterm UTF-8 mouse xterm-1006 xterm SGR-mouse xterm-16color xterm with 16 colors like aixterm xterm-256color xterm with 256 colors xterm-88color xterm with 88 colors xterm-8bit xterm terminal emulator 8-bit controls (X Window System) xterm-basic modern xterm terminal emulator - common xterm-bold xterm terminal emulator (X11R6 Window System) standout w/bold xterm-direct xterm with direct-color indexing xterm-direct2 xterm with direct-color indexing (old) xterm-hp xterm with hpterm function keys xterm-new modern xterm terminal emulator xterm-nic xterm with ich/ich1 suppressed for non-curses programs xterm-noapp xterm with cursor keys in normal mode xterm-old antique xterm version xterm-pcolor xterm with color used for highlights and status line xterm-r5 xterm R5 version xterm-r6 xterm X11R6 version xterm-sco xterm with SCO function keys xterm-sun xterm with sunFunctionKeys true xterm-utf8 xterm with no VT100 line-drawing in UTF-8 mode xterm-vt220 xterm emulating vt220 xterm-vt52 xterm emulating dec vt52 xterm-x10mouse X10 xterm mouse xterm-x11hilite X11 mouse with highlight xterm-x11mouse X11 mouse xterm-xf86-v32 xterm terminal emulator (XFree86 3.2 Window System) xterm-xf86-v33 xterm terminal emulator (XFree86 3.3 Window System) xterm-xf86-v333 xterm terminal emulator (XFree86 3.3.3 Window System) xterm-xf86-v40 xterm terminal emulator (XFree86 4.0 Window System) xterm-xf86-v43 xterm terminal emulator (XFree86 4.3 Window System) xterm-xf86-v44 xterm terminal emulator (XFree86 4.4 Window System) xterm-xfree86 xterm terminal emulator (XFree86) xterm-xi xterm on XI Graphics Accelerated X under BSD/OS 3.1 xterm-color generic color xterm xterm-24 xterm terminal emulator (X Window System)七、命令infocmp来比较两个终端的区别
比如 infocmp vt100 vt220 将会输出 vt100 和 vt220 的区别:
[root@htlwk0001host ~]# infocmp vt100 vt220
comparing vt100 to vt220.
comparing booleans.
mir: F:T.
comparing numbers.
comparing strings.
blink: 'E[5m$<2>', 'E[5m'.
bold: 'E[1m$<2>', 'E[1m'.
clear: 'E[HE[J$<50>', 'E[HE[J'.
cuf1: 'E[C$<2>', 'E[C'.
cup: 'E[%i%p1%d;%p2%dH$<5>', 'E[%i%p1%d;%p2%dH'.
cuu1: 'E[A$<2>', 'E[A'.
dch: NULL, 'E[%p1%dP'.
dch1: NULL, 'E[P'.
dl: NULL, 'E[%p1%dM'.
dl1: NULL, 'E[M'.
...



