who
瑞兹 发表于 2020-12-20 00:08浏览次数:
在类似Unix的操作系统上,who命令显示登录到系统的用户。
On Unix-like operating systems, the who command displays users logged in to the system.
目录:
1 who 运行系统环境
2 who 描述
3 who 语法
4 who 例子
who 运行系统环境
who 描述
该who显示当前登录的所有用户命令打印的信息。
The who command prints information about all users who are currently logged in.
who 语法
who [ OPTION ]... [ FILE ] [ am i ]
选件
-a,--all
|
与使用选项-b -d --login -p -r -t -T -u相同。
|
-b,--boot
|
显示上一次系统引导的时间。
|
-d,--dead
|
显示死进程。
|
-H,--heading
|
打印一行列标题。
|
--ips
|
打印IP地址而不是主机名。使用--lookup,可以基于存储的IP(如果可用)而不是存储的主机名进行规范化。
|
-l,--login
|
打印系统登录过程。
|
--lookup
|
尝试通过DNS规范化主机名。
|
-m
|
仅打印有关与标准输入(发出命令的终端)关联的用户和主机的信息。此方法符合POSIX标准。
|
-p,-process
|
打印由init产生的活动进程。
|
-q,-- count
|
显示所有登录名以及所有已登录用户的数量。
|
-r,-- runlevel
|
打印当前运行级别。
|
-s,-- short
|
仅打印名称,行和时间字段,这是默认设置。
|
-t,--time
|
如果有此信息,请打印上次更改系统时钟的时间。
|
-T,-w,-- mesg
|
添加一个指示终端线路状态的字符:如果终端可写,则添加“ + ”;否则,则添加“ - ”;如果遇到不良线路,则添加“ ? ”。
|
-u,--users
|
打印每个用户的空闲时间和进程ID。
|
--message
|
与-T相同。
|
--writable
|
与-T相同。
|
--help
|
显示帮助消息,然后退出。
|
--version
|
显示版本信息,然后退出。
|
笔记
如果指定了FILE,则who将从此文件中收集其信息。否则,它将从默认文件位置(通常是/ var / run / utmp)读取。
如果指定了参数“ am i ”,那么who将使用-m选项。
who [ OPTION ]... [ FILE ] [ am i ]
Options
-a, --all
|
Same as using the options -b -d --login -p -r -t -T -u.
|
-b, --boot
|
Display the time of the last system boot.
|
-d, --dead
|
Display dead processes.
|
-H, --heading
|
Print a line of column headings.
|
--ips
|
Print IP addresses instead of hostnames. With --lookup, canonicalizes based on stored IP, if available, rather than stored hostname.
|
-l, --login
|
Print system login processes.
|
--lookup
|
Attempt to canonicalize hostnames via DNS.
|
-m
|
Only print information about the user and host associated with standard input (the terminal where the command was issued). This method adheres to the POSIX standard.
|
-p, --process
|
Print active processes spawned by init.
|
-q, --count
|
Displays all login names, and a count of all logged-on users.
|
-r, --runlevel
|
Print the current runlevel.
|
-s, --short
|
Print only name, line, and time fields, which is the default.
|
-t, --time
|
Print the last time the system clock was changed, if the information is available.
|
-T, -w, --mesg
|
Add a character which indicates the state of the terminal line: "+" if the terminal is writable, "-" if it's not, or "?" if a bad line is encountered.
|
-u, --users
|
Print the idle time for each user, and the process ID.
|
--message
|
Same as -T.
|
--writable
|
Same as -T.
|
--help
|
Display a help message, and exit.
|
--version
|
Display version information, and exit.
|
Notes
If FILE is specified, who gathers its information from this file. Otherwise, it reads from a default file location (usually /var/run/utmp).
If the arguments "am i" are specified, who assumes the -m option.
who 例子
who
显示所有当前登录会话的用户名,行和时间。例如:
who am i
显示相同的信息,但仅针对发出命令的终端会话,例如:
alan pts/3 2013-12-25 08:52 (:0.0)
who -aH
显示“所有”信息以及每列数据上方的标题,例如:
NAME LINE TIME IDLE PID COMMENT EXIT
2014-01-17 07:00 154 id=si term=0 exit=0
system boot 2014-01-17 07:00
run-level 2 2014-01-17 07:00 last=S
2014-01-17 07:01 1607 id=l2 term=0 exit=0
LOGIN tty6 2014-01-17 07:01 2809 id=6
LOGIN tty5 2014-01-17 07:01 2808 id=5
LOGIN tty4 2014-01-17 07:01 2807 id=4
LOGIN tty2 2014-01-17 07:01 2805 id=2
LOGIN tty1 2014-01-17 07:01 2804 id=1
LOGIN tty3 2014-01-17 07:01 2806 id=3
pts/0 2014-01-17 11:31 2811 id=ts/0 term=0 exit=0
lucy + pts/1 2014-01-17 22:42 . 6609 (:0.0)
pts/2 2014-01-18 02:14 0 id=/2 term=0 exit=0
pts/3 2014-01-18 02:08 0 id=/3 term=0 exit=0
pts/4 2014-01-17 21:30 0 id=/4 term=0 exit=0
lucy + pts/0 2014-01-17 22:01 01:04 6330 (:0.0)
who
Displays the username, line, and time of all currently logged-in sessions. For example:
who am i
Displays the same information, but only for the terminal session where the command was issued, for example:
alan pts/3 2013-12-25 08:52 (:0.0)
who -aH
Displays "all" information, and headers above each column of data, for example:
NAME LINE TIME IDLE PID COMMENT EXIT
2014-01-17 07:00 154 id=si term=0 exit=0
system boot 2014-01-17 07:00
run-level 2 2014-01-17 07:00 last=S
2014-01-17 07:01 1607 id=l2 term=0 exit=0
LOGIN tty6 2014-01-17 07:01 2809 id=6
LOGIN tty5 2014-01-17 07:01 2808 id=5
LOGIN tty4 2014-01-17 07:01 2807 id=4
LOGIN tty2 2014-01-17 07:01 2805 id=2
LOGIN tty1 2014-01-17 07:01 2804 id=1
LOGIN tty3 2014-01-17 07:01 2806 id=3
pts/0 2014-01-17 11:31 2811 id=ts/0 term=0 exit=0
lucy + pts/1 2014-01-17 22:42 . 6609 (:0.0)
pts/2 2014-01-18 02:14 0 id=/2 term=0 exit=0
pts/3 2014-01-18 02:08 0 id=/3 term=0 exit=0
pts/4 2014-01-17 21:30 0 id=/4 term=0 exit=0
lucy + pts/0 2014-01-17 22:01 01:04 6330 (:0.0)
未知的网友