HP-UX Reference (11i v1 05/09) - 1 User Commands N-Z (vol 2)

w
who(1) who(1)
NAME
who - who is on the system
SYNOPSIS
who [-muTlHqpdbrtasAR
][file ]
who am i
who am I
DESCRIPTION
The who 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
/etc/utmp file to obtain its information. If file is given, that file is
examined. Usually, file is
/var/adm/wtmp
, which contains a history of all of the logins since the file was
last created.
The
who command with the am i
or am I option identifies the invoking user.
Except for the default
-s option, the general format for output entries is:
name [ state] line time activity pid [ comment ] [ exit ]
With options, who can list logins, logoffs, reboots, and changes to the system clock, as well as other
processes spawned by the init process.
Options
-m Output only information about the current terminal. This option is equivalent to the
am i and am I options described above.
-u 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 /dev. 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 old. This field is use-
ful 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 comment is the comment field
associated with this line as found in
/etc/inittab (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 who
prints, as the comment, the user’s host name as it was stored in the
/etc/utmp or
named file. Note that the users host name is printed instead of comments from the
/etc/inittab file if the -u option is used in conjunction with the -R option.
-T Same as the -u 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 termi-
nal is writable by anyone; a - appears if it is not. root can write to all lines having a
+ or a - in the state field. If a bad line is encountered, a ? is printed.
(XPG4 only.) Only the following fields are displayed: name state line time
-l Lists 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.
-H Prints column headings above the regular output.
-q A quick who, displaying only the names and the number of users currently logged in.
When this option is used, all other options are ignored.
-p Lists any other process which is currently active and has been previously spawned by
init. The name eld is the name of the program executed by init as found in
/etc/inittab . The state, line, and activity fields have no meaning. The comment
field shows the id field of the line from /etc/inittab that spawned this process.
See inittab(4).
Section 11062 Hewlett-Packard Company 1 HP-UX 11i Version 1: September 2005