The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

who - display who is on the system

 SYNOPSIS



who [-mu]-s[-bHlprt][file]

who [-mTu][-abdHlprt][file]

who -q [file]

who am i

who am I

 DESCRIPTION

The who utility lists various pieces of information about accessible users. The domain of accessibility is implementation-dependent.

Based on the options given, who also can list the user's name, terminal line, login time, elapsed time since activity occurred on the line and the process ID of the command interpreter for each current system user.

 OPTIONS

The who utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported. The metavariables, such as <line>, refer to fields described in the STDOUT section.

-a
Process the implementation-dependent database or named file with the -b, -d, -l, -p, -r, -t, -T and -u options turned on.
-b
Write the time and date of the last reboot.
-d
Write a list of all processes that have expired and not been respawned by the init system process. The <exit> field appears for dead processes and contains the termination and exit values of the dead process. This can be useful in determining why a process terminated.
-H
Write column headings above the regular output.
-l
(The letter ell.) List only those lines on which the system is waiting for someone to login. The <name> field is LOGIN in such cases. Other fields are the same as for user entries except that the <state> field does not exist.
-m
Output only information about the current terminal.
-p
List any other process that is currently active and has been previously spawned by init.
-q
(Quick.) List only the names and the number of users currently logged on. When this option is used, all other options are ignored.
-r
Write the current run-level of the init process.
-s
List only the <name>, <line> and <time> fields. This is the default case.
-t
Indicate the last change to the system clock.
-T
Show the state of each terminal, as described in the STDOUT section.
-u
This option lists only those users who are currently logged in. Output the user's "idle time" in addition to any other information. The idle time is the time since any activity occurred on the user's terminal. The method of determining this is unspecified. The <name> is the user's login name. The <line> is the name of the line as found in the directory /dev. The <time> is the time that the user logged in. The <activity> is the number of hours and minutes since activity last occurred on that particular line. A dot indicates that the terminal has seen activity in the last minute and is therefore "current." If more than twenty-four hours have elapsed or the line has not been used since boot time, the entry is marked <old>. This field is useful when trying to determine whether a person is working at the terminal or not. The <pid> is the process ID of the user's login process.

 OPERANDS

The following operands are supported:
am i
am I
In the POSIX locale, limit the output to describing the invoking user, equivalent to the -m option. The am and i or I must be separate arguments.
file
Specify a pathname of a file to substitute for the implementation-dependent database of logged-on users that who uses by default.

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of who:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
LC_TIME
Determine the locale used for the format and contents of the date and time strings.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

The who utility writes its default information to the standard output in the following general format:

<name>[<state>]<line><time>[<activity>][<pid>][<comment>][<exit>]

The following format is used for the -T option:

"%s %c %s %s\n", <name>,
<terminal state>,
<terminal name>,
<time of login>
where <terminal state> is one of the following characters:
+
The terminal allows write access to other users.
-
The terminal denies write access to other users.
?
The terminal write-access state cannot be determined.

In the POSIX locale, the <time of login> is equivalent in format to the output of:


date +"%b %e %H:%M"

If the -u option is used with -T, the idle time is added to the end of the previous format in an unspecified format.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

The name init used for the system process is the most commonly used on historical systems, but it may vary.

The "domain of accessibility" referred to is a broad concept that permits interpretation either on a very secure basis or even to allow a network-wide implementation like the historical

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

mesg.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]