Linux命令之who
1.who介绍
linux命令who用来显示哪些用户连接到服务器上。显示的信息包括用户名、终端、上线时间、从哪连接上来的等
2.who用法
who [参数]
参数 | 说明 |
-H | 显示标题信息列 |
--help | 在线帮助信息 |
--version | 显示版本信息 |
3.实例
3.1.显示当前登录系统的用户
命令:
who
[root@rhel77 ~]# who
root tty1 2023-07-02 15:38
root pts/0 2023-07-02 15:39 (192.168.10.1)
[root@rhel77 ~]#
3.2.显示当前登录系统的用户(包含标题)
命令:
who -H
[root@rhel77 ~]# who -H
NAME LINE TIME COMMENT
root tty1 2023-07-02 15:38
root pts/0 2023-07-02 15:39 (192.168.10.1)
[root@rhel77 ~]#
NAME:用户名
LINE:终端机信息
TIME:上线时间
COMMENT:从哪连上来的
3.3.显示帮助信息
命令:
who --help
[root@rhel77 ~]# who --help
Usage: who [OPTION]... [ FILE | ARG1 ARG2 ]
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 exitIf FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common.
If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'who invocation'
[root@rhel77 ~]#
3.4.显示版本信息
命令:
who --version
[root@rhel77 ~]# who --version
who (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.
[root@rhel77 ~]#