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

Linux who command

Linux Command大全

The Linux who command is used to display which users are currently logged in to the system, and the displayed information includes user ID, terminal used, from where connected, login time, idle time, CPU usage, actions, etc.

Access Permission: All users can use it.

Syntax

who - [husfV] [user]

Parameter Description:

  • -H or --heading: Display the title information column of each field;
  • -i or -u or --idle: Display idle time, if the user has performed any action within the past minute, it will be marked with a '.' mark, if the user has exceeded24No action for an hour, then mark the 'old' string;
  • -m: The effect of this parameter is the same as specifying the 'am i' string;
  • -q or--count: Only display the account names logged into the system and the total number of people;
  • -s: This parameter will ignore and not handle, only responsible for solving compatibility problems with other versions of the who command;
  • -w or-T or--mesg or--message or--writable: Display user information status bar;
  • --help: Online help;
  • --version: Display version information.

Online Examples

Display the current user logged into the system

# who  //Display the current user logged into the 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 User Login Source

# 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 Terminal Attributes

# 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)

Only display the current user

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

Display in Minimal Mode

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

Linux Command大全