Who (Unix)

From Wikipedia, the free encyclopedia

The correct title of this article is who (Unix). The initial letter is shown capitalized due to technical restrictions.

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

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

Contents

[edit] Specification

The Single Unix Specification (SUS) specifies that who 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 am i or am I (so it is invoked as who am i or am I), showing information about the current terminal only (see the -m option below, of which this invocation is equivalent).

[edit] Usage

The SUS without extensions only specifies the following -m, -T, and -u options, all other options are specified in the XSI extension.

-a, process the system database used for user information with the -b, -d, -l, -p, -r, -t, -T and -u.
-b, show time when system was last rebooted
-d, show zombie processes and details
-H, show column headers
-l, show terminals where a user can log in
-m, show information about the current terminal only
-p, show active processes
-q, quick format, show only names and the number of all users logged on, disables all other options; equivalent to users command line utility
-r, show runlevel of the init process.
-s, (default) show only name, terminal, and time details
-t, show when system clock was last changed
-T, show details of each terminal in a standard format (see note in Examples section)
-u, 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 -i option behaving similarly to -u and a -w option displaying whether the user listed accepts messages (the SUS displays this when -T is specified), yet GNU who and BSD who both omit a number of the above options (such as -a, -b, -d, and others); GNU who instead uses -l to perform DNS lookups on hostnames listed.

[edit] Examples

The SUS without extensions specifies that the output format is to be "implementation-defined"; the XSI extension specifies a format (see the specification document), but notes that the output format is not fully specified (delimiters and field lengths are not precisely specified).

Thus, the format of the output differs considerably between Unix implementations.

AIX

Headings added for clarity

$ who   
User        tty          login@          PCPU
unixguy     pts/4        Oct 20 15:35    (wrk1.foo.com)
user2       pts/11       Oct 18 14:05    (wrk2.foo.com)
$ who -a
Name [state] line       time         [idle] [pid] [comment]        [exit]
   .       system boot  Sep 15 10:42
   .       run-level 3  Sep 15 10:43     3      0  S
rc2             .       Sep 15 10:45  old     153  id=  s2 term=0   exit=0
LOGIN      console      Oct  5 13:20  3:42  28779
unixguy    pts/1        Oct 19 12:05  0:04  12453  id=ts/1 term=0   exit=0

Solaris

user19    pts/35       Apr 18 08:40    (localhost)
user28    pts/27       Apr 18 09:50    (localhost)

GNU/Linux

jsmith   pts/124  Apr 11 11:04
pjones   pts/125  Apr 11 11:08

HP-UX

mjones    pts/0        Apr 18 10:01
tlin      pts/2        Apr 17 15:17

Mac OS X / Mac OS X Server

jsare     console      Apr 18 09:50
jsare     ttyp1        Apr 18 10:01
admin     ttyp2        Apr 17 15:17

[edit] See also

[edit] External links

  • who -- specification from the Single Unix Specification

[edit] Manual pages

In other languages