English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux who命令

大全 command Linux

Linux who命令用于显示系统中有哪些用户正在使用,显示的信息包括用户ID、使用的终端、连接来源、登录时间、停留时间、CPU使用量、操作等。

使用权限:所有用户都可以使用。

语法

qui - [husfV] [user]

说明参数

  • -H ou --heading:显示各栏位的标题信息列;
  • -i or -u or --idle:display idle time, if the user has performed any action within one minute, it will be marked with a dot, if the user has exceeded24no action for hours, then mark the string "old";
  • -m:the effect of this parameter is the same as specifying the string "am i";
  • -q or--count:only display the name of the account logged into the system and the total number of people;
  • -s:this parameter will ignore and not handle, only responsible for solving compatibility problems of other versions of the who command;
  • -w or-T or--mesg or--message or--writable:display status bar information user;
  • --help:help online;
  • --version:display information version.

example online

display user logged in current system

# who  //display user logged in current system
root   tty7     2014-05-13 12:12 (:0)
root   pts/0    2014-05-14 17:09 (:0.0)
root   pts/1    2014-05-14 18:51 (192.168.1.17)
root   pts/2    2014-05-14 19:48 (192.168.1.17)

display title bar

# who -H
NAME   LINE     TIME       COMMENT
root   tty7     2014-05-13 12:12 (:0)
root   pts/0    2014-05-14 17:09 (:0.0)
root   pts/1    2014-05-14 18:51 (192.168.1.17)
root   pts/2    2014-05-14 19:48 (192.168.1.17)

display source login user

# who -l -H
NAME   LINE     TIME       IDLE     PID COMMENT
LOGIN  tty4     2014-05-13 12:11        852 id=4
LOGIN  tty5     2014-05-13 12:11        855 id=5
LOGIN  tty2     2014-05-13 12:11        862 id=2
LOGIN  tty3     2014-05-13 12:11        864 id=3
LOGIN  tty6     2014-05-13 12:11        867 id=6
LOGIN  tty1     2014-05-13 12:11       1021 id=1

display attribute terminal

# who -T -H
NAME    LINE     TIME       COMMENT
root   + tty7     2014-05-13 12:12 (:0)
root   + pts/0    2014-05-14 17:09 (:0.0)
root   - pts/1    2014-05-14 18:51 (192.168.1.17)
root   - pts/2    2014-05-14 19:48 (192.168.1.17)

display only current user

# who -m -H
NAME   LINE     TIME       COMMENT
root   pts/1    2014-05-14 18:51 (192.168.1.17)

display mode simplified

# who -q
root root root root
# users=4

大全 command Linux