who — Display information about current users

Format

  • who[–AabdHilmprsTtuw] [file]
  • who –q[file]
  • who am I|i

Description

who displays information about users who are logged into the system. By default, the output contains the user's login name, terminal name, and the time that the user logged in. Normally, who consults the file /etc/utmpx for information, but you can use the file argument to specify another accounting file.

When called as:
who am i
or
who am I
who displays your login name, terminal, and login time. This command works only in the POSIX locale.

Options

–A
Displays all accounting entries.
–a
Displays all types of entries. This is equivalent to specifying –AbdHilprTtuw.
–b
Displays all entries written at system boot time.
–d
Displays entries produced after the death of a process spawned from /usr/sbin/init.
–H
Displays column headings above the output.
–i
Displays idle time for users. The idle time is the hours:minutes since the last activity; a dot (.) means that the terminal has been used in the last minute, and the string old means that the terminal has not been used in more than 24 hours, or hasn't been used since boot time.
–l
Displays logged-out user entries.
–m
Displays information about current terminal only.
–p
Displays entries for processes spawned from /usr/sbin/init.
–q
Displays a quick list with the number of users and their names; other options are ignored.
–r
Displays all run-level change entries.
–s
Displays only the three fields user name, terminal, and time of entry.
–T
Displays the state of each terminal as a plus sign (+) if the terminal allows write access to other users, and a minus sign () if write access is denied. who displays a question mark (?) if the write access cannot be determined.
–t
Displays all time change entries (both old and new time).
–u
Displays only entries associated with logged-in users. who enables this option when you do not provide any options on the command line.
–w
Displays the terminal state; this indicates whether the terminal can be written to.

Files

who uses the following files:
/etc/utmpx
Displays the current status file.

Localization

who uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • LC_TIME
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
2
Failure because of an incorrect command-line option, or because of too many command-line arguments.

Portability

POSIX.2 User Portability Extension, X/Open Portability Guide.

The utmpx file format, the options, and the output of who are totally compatible with UNIX System V.

The –A, –a, –b, –d –i, –l, –p, –r, –s, –t, –w, and am I options are extensions to the POSIX standard.

Related information

See the utmpx file format description in File formats for more information.