who命令与w命令相似,但要比w命令显示更加详细的信息。
[root@rusky opt]# man who
WHO(1) User Commands WHO(1)
NAME
who - show who is logged on
SYNOPSIS
who [OPTION]... [ FILE | ARG1 ARG2 ]
DESCRIPTION
Print information about users who are currently logged in.
-a, --all
same as -b -d --login -p -r -t -T -u
-b, --boot
time of last system boot
-d, --dead
print dead processes
-H, --heading
print line of column headings
-l, --login
print system login processes
--lookup
attempt to canonicalize hostnames via DNS
-m only hostname and user associated with stdin
-p, --process
print active processes spawned by init
-q, --count
all login names and number of users logged on
-r, --runlevel
print current runlevel
-s, --short
print only name, line, and time (default)
-t, --time
print last system clock change
-T, -w, --mesg
add user's message status as +, - or ?
-u, --users
list users logged in
--message
same as -T
--writable
same as -T
--help display this help and exit
--version
output version information and exit
============
常用who命令:
[root@rusky opt]# who root pts/0 Dec 31 14:13 (192.168.1.111) rusky1 pts/1 Dec 31 15:58 (192.168.1.111) rusky1 pts/2 Dec 31 16:00 (192.168.1.111) [root@rusky opt]# who -b --time of last system boot system boot Dec 27 05:06 [root@rusky opt]# who -r ---print current runlevel run-level 5 Dec 27 05:06 [root@rusky opt]# who -q ---all login names and number of users logged on root rusky1 rusky1 # users=3 [root@rusky opt]# who -s root pts/0 Dec 31 14:13 (192.168.1.111) rusky1 pts/1 Dec 31 15:58 (192.168.1.111) rusky1 pts/2 Dec 31 16:00 (192.168.1.111) [root@rusky opt]# who -a system boot Dec 27 05:06 run-level 5 Dec 27 05:06 LOGIN tty3 Dec 27 05:06 3508 id=3 LOGIN tty2 Dec 27 05:06 3506 id=2 LOGIN tty4 Dec 27 05:06 3510 id=4 LOGIN tty5 Dec 27 05:06 3514 id=5 LOGIN tty6 Dec 27 05:06 3516 id=6 root + pts/0 Dec 31 14:13 . 31733 (192.168.1.111) rusky1 + pts/1 Dec 31 15:58 00:33 581 (192.168.1.111) rusky1 + pts/2 Dec 31 16:00 00:39 581 (192.168.1.111) pts/3 Dec 31 16:21 1084 id=ts/3 term=0 exit=0