Who (Unix)

The standard Unix command  displays a list of users who are currently logged into the computer.

The  command is related to the command w, which provides the same information but also displays additional data and statistics.

History
A who command that displays the names of users logged in was first implemented within Multics. Later, it appeared in Version 1 Unix and became part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification.

The version of  bundled in GNU coreutils was written by Joseph Arceneaux, David MacKenzie, and Michael Stone.

Specification
The Single UNIX Specification (SUS) specifies that  should list information about accessible users. The XSI extension also specifies that the data of the username, terminal, login time, process ID, and time since last activity occurred on the terminal, furthermore, an alternate system database used for user information can be specified as an optional argument to who.

The command can be invoked with the arguments  or   (so it is invoked as   or  ), showing information about the current terminal only (see the command tty and the   option below, of which this invocation is equivalent).

Usage
The SUS without extensions only specifies the following,  , and   options, all other options are specified in the XSI extension.


 * , process the system database used for user information with the,  ,  ,  ,  ,  ,   and.
 * , show time when system was last rebooted
 * , show zombie processes and details
 * , show column headers
 * , show terminals where a user can log in
 * , show information about the current terminal only
 * , show active processes
 * , quick format, show only names and the number of all users logged on, disables all other options; equivalent to users command line utility
 * , show runlevel of the init process.
 * , (default) show only name, terminal, and time details
 * , show when system clock was last changed
 * , show details of each terminal in a standard format (see note in Examples section)
 * , show idle time; XSI shows users logged in and displays information whether the terminal has been used recently or not

Other Unix and Unix-like operating systems may add extra options. GNU who includes a  option behaving similarly to   and a   option displaying whether the user listed accepts messages (the SUS displays this when   is specified), yet GNU   and BSD   both omit a number of the above options (such as ,  ,  , and others); GNU   instead uses   to perform DNS lookups on hostnames listed.

Output
The SUS without extensions specifies that the output format is to be "implementation-defined". The XSI extension specifies a format, but notes that it is not fully specified; delimiters and field lengths are not precisely specified. Thus, the format of the output differs considerably among Unix implementations.