Name

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

Synopsis

who [options] [filename]

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

who
smith    console   Sep  6 17:09
barrett  ttys000   Sep  6 17:10 (example.com)
jones    ttys001   Sep  8 20:58 (192.168.13.7)
jones    ttys002   Sep  3 05:11 (192.168.13.7)

Normally, who gets its data from the file /var/run/utmpx. The filename argument can specify a different data file, if you happen to have one in the right format.

Useful options

-H

Print a row of headings as the first line.

-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 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.

Get Macintosh Terminal Pocket Guide 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.