who:显示已登录用户信息
简介who命令显示已经登录系统的用户,以及系统启动时间等信息
说明
who命令显示已经登录系统的用户,以及系统启动时间等信息
格式
who [option]
常用参数
- -a:显示所有信息
- -b:显示系统启动时间
- -d:显示已死的进程
- -H:显示标题,默认不显示
- -l:显示登录进程
示例
[root@localhost ~]# who
root pts/0 2018-05-14 03:05 (192.168.71.1)
root pts/1 2018-05-14 03:45 (192.168.71.1)
root pts/2 2018-05-14 03:45 (192.168.71.1)
[root@localhost ~]# who -a
system boot 2018-05-11 19:17
run-level 3 2018-05-11 19:18
LOGIN tty1 2018-05-11 19:18 2221 id=tty1
root + pts/0 2018-05-14 03:05 . 88743 (192.168.71.1)
root + pts/1 2018-05-14 03:45 00:11 90858 (192.168.71.1)
root + pts/2 2018-05-14 03:45 00:12 90892 (192.168.71.1)
pts/3 2018-05-13 05:42 12172 id=ts/3 term=0 exit=0
pts/4 2018-05-13 05:42 12210 id=ts/4 term=0 exit=0
pts/5 2018-05-13 05:42 12251 id=ts/5 term=0 exit=0
pts/6 2018-05-13 06:42 21920 id=ts/6 term=0 exit=0
pts/7 2018-05-13 08:31 25307 id=ts/7 term=0 exit=0
[root@localhost ~]# who -b
system boot 2018-05-11 19:17
[root@localhost ~]# who -d
pts/3 2018-05-13 05:42 12172 id=ts/3 term=0 exit=0
pts/4 2018-05-13 05:42 12210 id=ts/4 term=0 exit=0
pts/5 2018-05-13 05:42 12251 id=ts/5 term=0 exit=0
pts/6 2018-05-13 06:42 21920 id=ts/6 term=0 exit=0
pts/7 2018-05-13 08:31 25307 id=ts/7 term=0 exit=0
[root@localhost ~]# who -H
NAME LINE TIME COMMENT
root pts/0 2018-05-14 03:05 (192.168.71.1)
root pts/1 2018-05-14 03:45 (192.168.71.1)
root pts/2 2018-05-14 03:45 (192.168.71.1)
[root@localhost ~]# who -l
LOGIN tty1 2018-05-11 19:18 2221 id=tty1