Linux常用命令-tty

命令

tty

描述

print the file name of the terminal connected to standard input
显示当前登录的终端名称

用法

1
tty [OPTION]...

选项

注意

示例

1
2
3
4
5
6
7
8
9
10
11
# 本地登录
$ tty
/dev/tty1
# 远程登录
$ tty
/dev/pts/0
$ w
20:20:18 up 4 min, 2 users, load average: 0.00, 0.01, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 20:19 42.00s 0.00s 0.00s -bash
root pts/0 192.168.80.1 20:18 2.00s 0.03s 0.00s w