Who (Unix)

Revision as of 04:05, 15 May 2025 by imported>Steel1943 (→‎History: fix common MOS:REFSPACE spacing errors, replaced: /ref> <ref → /ref><ref)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:Lowercase {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other The standard Unix command who displays a list of users who are currently logged into the computer.

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

HistoryEdit

A <syntaxhighlight lang="text" class="" style="" inline="1">who</syntaxhighlight> command that displays the names of users logged in was first implemented for the CTSS operating system by Noel Morris in 1965. This inspired Tom Van Vleck to write a Multics version.<ref name=Multix>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>Template:Man</ref> Later, it appeared in Version 1 Unix<ref>Template:Man</ref> and became part of the X/Open Portability Guide since issue 2 of 1987. It was inherited by the first version of POSIX.1 and the Single Unix Specification.

The existence of <syntaxhighlight lang="text" class="" style="" inline="1">who</syntaxhighlight> presupposes the existence of an online group of users in a shared collegial environment with a need to communicate with each other.Template:R

The version of who bundled in GNU coreutils was written by Joseph Arceneaux, David MacKenzie, and Michael Stone.<ref>Template:Man</ref>

SpecificationEdit

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 Template:Mono.

The command can be invoked with the arguments am i or am I (so it is invoked as who am i or who am I), showing information about the current terminal only (see the command Template:Mono and the -m option below, of which this invocation is equivalent).

UsageEdit

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 Template:Mono 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.

OutputEdit

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.

See alsoEdit

ReferencesEdit

Template:Reflist

External linksEdit

Template:Sister project

Template:Unix commands Template:Plan 9 commands Template:Core Utilities commands