|
Quick links About
who Syntax Examples
Related commands Linux / Unix main page
About who
Displays who is on the system.
Syntax
who [-a] [-b] [-d] [-H] [-l] [-m] [-nx] [-p] [-q] [-r]
[-s] [-t] [-T] [-u] [am i] [ file ]
| -a |
Process /var/adm/utmp or the named file with -b, -d, -l, -p, -r, -t, -T, and -u options turned on. |
| -b |
Indicate the time and date of the last reboot. |
| -d |
Display all processes that have expired and not been respawned by init . The exit field appears for dead processes and contains the termination and exit values (as returned by
wait), of the dead process. This can be useful in determining why a process terminated. |
| -H |
Output column headings above the regular output. |
| -l |
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. |
| -n x |
Take a numeric argument, x, which specifies the number of users to display per line. x must be at least 1. The -n option may only be used with -q. |
| -p |
List 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 init
as found in /sbin/inittab. The state, line , and idle fields have no meaning. The comment field
shows the id field of the line from /sbin/inittab that spawned this process. |
| -q |
(quick who ) display only the names and the number of users currently logged on. When this option is used, all other options are ignored. |
| -r |
Indicate the current run-level of the init
process. |
| -s |
(default) List only the name, line, and time fields. |
| -t |
Indicate the last change to the system clock (using the date utility) by root. See
su and date. |
| -T |
Same as the -s option, except that the state field is also written. state is one of the characters listed under the
/usr/bin/who version of this option. If the -u option is used with -T, the idle time is added to the end of the previous format. |
| -u |
List only those users who are currently logged in. 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 idle column contains 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 shell. The comment is the comment field associated with this line as found in
/sbin/inittab. This can contain information about where the terminal is located, the telephone number of the dataset, type
of terminal if hard-wired, and so forth. |
| am i |
In the "C" 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 path name of a file to substitute for the database of logged-on users that who uses by default. |
Examples
who
The general format for output is:
name [state] line time [idle] [pid] [comment] [exit]
where:
name user's login name.
state capability of writing to the terminal.
line name of the line found in /dev.
time time since user's login.
idle time elapsed since the user's last activity.
pid user's process id.
comment comment line in inittab(4).
Below is an example of what this may look like
| chope |
pts/0 |
Apr 23 10:43 |
(shell.computerhope.com) |
| hope |
pts/1 |
May 6 18:19 |
(shell.computerhope.com) |
Related commands
date
login mesg
su
w
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|