who(1)who(1)NAMEwho - who is on the system
SYNOPSIS
[file]
DESCRIPTION
The command can list the user's name, terminal line, login time,
elapsed time since input activity occurred on the line, the user's host
name, and the process-ID of the command interpreter (shell) for each
current system user. It examines the database to obtain the informa‐
tion. If file is given, that file is examined, file should be a like
file.
The command with the or option identifies the invoking user.
Except for the default option, the general format for output entries
is:
name [state] line time activity pid [comment] [exit]
With options, can list logins, logoffs, reboots, and changes to the
system clock, as well as other processes spawned by the process.
Options
Output only information about the current terminal.
This option is equivalent to the and options
described above.
Lists only those users who are currently logged in.
name is the user's login name. line is the name
of the line as found in the directory The time
field indicates when the user logged in.
activity is the number of hours and minutes since
input 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 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. The com‐
ment is the comment field associated with this
line as found in (see inittab(4)). This can con‐
tain information about where the terminal is
located, the telephone number of the dataset,
type of terminal if hard-wired, etc. If no such
information is found, then prints, as the com‐
ment, the user's host name as it was stored in
the database or named file. Note that the user's
host name is printed instead of comments from the
file if the option is used in conjunction with
the option.
Same as the option, except that the state of the terminal
line is printed. state describes whether someone
else can write to that terminal. A appears if
the terminal is writable by anyone; a appears if
it is not. can write to all lines having a or a
in the state field. If a bad line is encoun‐
tered, a is printed.
(UNIX Standard only, see standards(5).) Only the
following fields are displayed: name state line
time
Lists only those lines
on which the system is waiting for someone to
login. The name field is in such cases. Other
fields are the same as for user entries except
that the state field does not exist.
Prints column headings above the regular output.
A quick displaying only the names and the number of users
currently logged in. When this option is used,
all other options are ignored.
Lists any other process which is currently active and has
been previously spawned by init. The name field
is the name of the program executed by as found
in The state, line, and activity fields have no
meaning. The comment field shows the id field of
the line from that spawned this process. See
inittab(4).
This option displays all processes
that have expired and have not been respawned by
The exit field appears for dead processes and
contains the termination and exit values of the
dead process (as returned by — see wait(2)).
This can be useful in determining why a process
terminated.
Indicates the time and date of the last reboot.
Indicates the current
run-level of the process. The last three fields
contain the current state of the number of times
that state has been previously entered, and the
previous state. These fields are updated each
time changes to a different run state.
Indicates the last change to the system clock (via the
command) by See su(1).
Processes database or the named file with all options
turned on.
Default. Lists only the
name, line, and time fields.
When the file is specified, (the option can be used to
examine the file) this option indicates when the
accounting system was turned on or off using the
or commands (see acctsh(1M)). The name field is
a dot The line field is or a reason that was
given as an option to the command. The time is
the time that the on/off activity occurred.
Displays the user's host name.
If the user is logged in on a tty, displays the
string returned from (see gethostname(2)). If
the user is not logged in on a tty and the host
name stored in the database or named like file
has not been truncated when stored (meaning that
the entire host name was stored with no loss of
information), it is displayed as it was stored.
Otherwise, the (IPv4) or (IPv6) function is
called with the internet address of the host (see
gethostent(3N)). The host name returned by
(IPv4) or (IPv6) is displayed unless it returns
an error, in which case the truncated host name
is displayed.
Gets the information from
file.
(UNIX Standard only, see standards(5). The option can not be used with
or options. If option is used with the idle time is added to the end of
the format.)
EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5).
Environment Variables
determines the locale to use for the locale categories when both and
the corresponding environment variable (beginning with do not specify a
locale. If is not set or is set to the empty string, a default of "C"
(see lang(5)) is used.
determines the locale for interpretation of sequences of bytes of text
data as characters (e.g., single- verses multibyte characters in argu‐
ments and input files).
determines the format and contents of date and time strings.
determines the language in which messages are displayed.
If any internationalization variable contains an invalid setting,
behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
Check who is logged in on the system:
Check whether or not you can write to the terminal that another user is
using:
and look for a plus after the user ID.
AUTHOR
was developed by AT&T and HP.
FILESSEE ALSOdate(1), login(1), mesg(1), su(1), init(1M), utmpd(1M), gethostname(2),
wait(2), gethostent(3N), getutsent(3C), getbwent(3C), inittab(4),
utmp(4), standards(5).
STANDARDS CONFORMANCEwho(1)