For faster navigation, this Iframe is preloading the Wikiwand page for who (Unix).

who (Unix)

此条目已列出参考文献,但因为没有文内引注而使来源仍然不明。 (2018年4月29日)请加上合适的文内引注来改善这篇条目

Linux系统who命令执行结果

who是显示当前登录到电脑的用户列表的标准 Unix 命令。

who与命令w有关:w提供相同的资讯,但也显示额外的数据和统计资讯。

规范

[编辑]

单一Unix规范(SUS)要求who应列出有关可访问用户的资讯。 XSI 扩展也要求应列出用户名、终端、登录时间、进程 ID 和自上次活动以来的时间等其他数据;此外,用于用户资讯的备用系统数据库可指定为who的可选参数。

该命令可以附加参数am iam I(即who am i),来调用显示有关当前终端的资讯(请参阅命令tty和-m选项,同该调用是等效的)。

用法

[编辑]

无扩展的SUS仅指定以下的-m-T-u选项,所有其他选项都在XSI扩展中指定:

-a,使用-b,-d,-l,-p,-r,-t,-T和-u处理用于用户资讯的系统数据库。
-b,显示系统上次重新启动的时间
-d,显示僵尸进程及相关细节
-H,显示列标题
-l,显示用户可以登录的终端
-m,仅显示有关当前终端的资讯
-p,显示活动进程
-q,快速格式,仅显示名称和所有登录用户的数量,禁用所有其他选项;相当于用户命令行实用程序
-r,显示init进程的运行级别。
-s(默认)仅显示名称,终端和时间详细资讯
-t,显示系统时钟最后更改的时间
-T,以标准格式显示每个终端的详细资讯
-u,显示空闲时间;XSI显示用户登录并显示终端是否最近使用过的资讯

其他Unix和类Unix操作系统可能会添加额外的选项。GNU who包含-i选项(同-u类似)和-w选项(显示列出的用户是否接受消息,SUS 在指定-T时显示此消息),但GNU who和BSD版本都省略了上述的一些选项(如-a,-b,-d等);GNU 版本反而使用 -l 来尝试通过 DNS 查验主机名。

输出

[编辑]

没有扩展名的SUS指定输出格式为“实现定义”(Implementation-defined)。 XSI扩展指定了一种格式,但它没有完全指定: 分隔符和字段长度没有精确指定。 因此,Unix实现中输出的格式差别很大。

另请参见

[编辑]

外部链接

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
who (Unix)
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?