Name

who — stdin  stdout  - file  -- opt  --help  --version

Synopsis

who [options] [filename]

The who command lists all logged-in users, one user shell per line:

$ who
smith    pts/0    Sep  6 17:09 (:0)
barrett  pts/1    Sep  6 17:10 (10.24.19.240)
jones    pts/2    Sep  8 20:58 (192.168.13.7)
jones    pts/4    Sep  3 05:11 (192.168.13.7)

Normally, who gets its data from the file /var/run/utmp. The filename argument can specify a different data file, such as /var/log/wtmp for past logins or /var/log/btmp for failed logins.[17]

Useful options

-H

Print a row of headings as the first line.

--lookup

For remotely logged-in users, print the hostnames of origin.

-u

Also print each user’s idle time at his/her terminal.

-T

Also indicate whether each user’s terminal is writable (see mesg in Instant Messaging). A plus sign means yes, a minus sign means no, and a question mark means unknown.

-m

Display information only about yourself, i.e., the user associated with the current terminal.

-q

Quick display of usernames only, and a count of users. Much like the users command, but it adds a count.

[17] If your system is configured to log this information.

Get Linux Pocket Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.