Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

who - display who is on the system

&pagelevel(4)&pagelevel

who provides information on:

  • the login and terminal name under which you are currently working

  • the login name, login time, and terminal name for each current system user

  • the process ID of the command interpreter (shell) being used

  • the last time a terminal was used

  • when logins, logouts, and system breakdowns have taken place since the /var/adm/wtmp file was cleared by the system administrator.

  • the last time the system clock was changed

  • the processes spawned by the init process


Hint

who normally gets its information from the /var/adm/utmp file. The information in this file is brought up to date every time a login is performed. In single-user mode no logins are performed. Thus after a shutdown to single-user mode who may not be able to supply accurate information about the current login status. Use who am i instead.


Syntax


Format 1: who[ -mu] -s[ -bHlprt][ file]
Format 2: who[ -mTu][ -abdHlprt][ file]
Format 3: who -q[ -n number][ file]
Format 4: who am i
Format 5: who am I



List detailed information
Format 1: who[ -mu] -s[ -bHlprt][ file]
Format 2: who[ -mTu][ -abdHlprt][ file]


No option specified

who lists the following for every system user currently logged in:

  • login name under which the user logged in

  • name of the terminal on which the user logged in

  • login time.

The columns in the output are described below in Output.

options

-a

(all)

Turns on options -b, -d, -l, -p, -r, -t, -T and -u.

-b

(boot)

Shows the date and time of the last reboot.

-d

(dead)

Shows all processes that have terminated and not been respawned by init. The terminated processes are output together with their exit status (EXIT field) and the number of the signal which terminated the process. This may be useful in determining why a process died.

-H

(headings)

Prints headings above the output columns.

-l

(login)

Lists the processes where the system is waiting for someone to log in. In such cases the entry in the NAME field is the name of the program (or LOGIN) and the STATE field does not appear. The other fields have their usual meanings.

-m

who only outputs information on the active terminal.

-p

(process)

Shows all processes spawned by the init process. The NAME field shows the name of the program executed by init. The LINE field is irrelevant in conjunction with the -p option, so only a dot is output in this field.

-r

(run level)

Shows the current run level of the init process. The LINE field indicates the current run level, the TIME field the date it was entered. IDLE shows the current run level in numeric form, PID shows how often the system has been in this state before, and COMMENT indicates the system’s previous run level. The NAME field has no meaning with the -r option.

-s

(standard)

Lists the users who are currently logged in. The NAME field gives the login name, LINE is the device name (without the /dev/) of the terminal on which the user logged in. TIME shows when the user logged in.

This option is the default. -s can not be combined with -a, -d or -T.

-T

(terminal)

The terminal state is output in addition to the default values.

The STATE field shows whether other users can write to the terminal: a plus sign + indicates that they can, a minus sign – means that they cannot. The POSIX administrator can write to any terminal. If it is not possible for the system to obtain this information, a query ? appears in this field.

-t

(time)

Shows the last time the system administrator changed the system clock (using the date command).

-u

(user)

Lists those users who are currently logged in. The NAME field is the user’s login name. LINE is the device name (without the /dev/) of the terminal on which the user logged in. TIME shows when the user logged in.

The IDLE field provides information on the last time there was activity on the terminal in question: a dot (.) indicates activity within the last minute. If the terminal has not been used for over 24 hours or since the system was last booted, the entry is marked old.

The PID field indicates the process ID of the command interpreter (shell) the user is working with.

file

Name of the file from which who obtains its information. file, if given, will typically be /var/adm/wtmp. who then provides information about logins, logouts and system breakdowns that have taken place since this file was last cleared by the system administrator.

file not specified:
who obtains its information from the file /var/adm/utmp.


Output

The following section lists the headings of the columns output by who and discusses the information displayed in each column. The special information produced by the -b, -d, -p, -r and -t options is explained above in the detailed option description.

NAME

The NAME field indicates the user’s login name.

STATE

The STATE indicates whether other users can write to the terminal: a plus sign + indicates that they can, a minus sign – means that they cannot. The system administrator can write to any terminal. A query in this field indicates that the line is defective.

LINE

The LINE field gives the device name (without the /dev/) of the terminal on which the user logged in.

TIME

The TIME field shows when the user logged in.

IDLE

The IDLE field provides information on the last time there was activity on the terminal in question: a dot (.) indicates activity within the last minute. If the terminal has not been used for over 24 hours or since the system was last booted, the entry is marked old.

PID

The PID field indicates the process ID of the command interpreter (shell) the user is working with.

COMMENT

The COMMENT field indicates the system’s previous run level.

EXIT

The EXIT column (exit status) is a list of dead processes together with the number of the signal which terminated each process. This may be useful in determining why a process died.

The NAME, LINE and TIME information is produced by options -a, -l, -s, -T and -u.

STATE is shown only by -T, IDLE, PID by -a, -l and -u. The -a option also provides information on the exit status (EXIT).


List concise information
Format 3: who -q[ -n number][ file]


-q

(quick)

who only outputs the names and number of users currently logged on. Additional options, with the exception of -n, are ignored.

-n number

who displays number users per line. number must be at least 1.

-n number not specified:
by default who displays users per line.

file

see Format 1


List information on the invoking user
Format 4: who am i
Format 5: who am I


The formats 4 and 5 are identical to who -m.

who lists:

  • the login name under which you logged in

  • the device name (without the /dev/) of the terminal on which you logged in

  • the login time.

File

/var/adm/utmp

File from which who obtains its information by default. This file records the latest status.

/var/adm/wtmp

This file can be used as an alternative to /var/adm/utmp. This file is regularly cleared by the system administrator.

Locale

The following environment variables affect the execution of who:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization 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 internationalization 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 and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other.

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 format and contents of date and time strings.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example 1

Listing general information on all users currently logged in by calling who without options.

$ who

CMPQD004   term/002     Mon Aug 18 16:48:21 MSZ 2008

QM212JNA   term/003     Mon Aug 18 17:24:54 MSZ 2008

Example 2

Listing detailed information with column headings on all users currently logged in by calling who with the -H and -u options.

$ who -Hu
NAME       LINE         TIME          IDLE    PID

CMPQD004   tty001       Mar  7 10:53   .     6252

QM212JNA   tty002       Mar  7 11:10  0:22   6289

Example 3

Listing concise information on all users currently logged in by calling who with the -q option.

$ who -q

CMPQD004 QM212JNA

# users=2

Example 4

Listing information on the invoking user with who am i.

$ who am i

 QM212JNA term/003 Mon Aug 18 17:24:54 MSZ 2008

See also

date, last, mesg

wait() [4]