Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

date(1)

login(1)

mesg(1)

su(1)

init(1)

wait(2)

inittab(4)

utmp(4)



  who(1)                              CLIX                              who(1)



  NAME

    who - Lists users logged onto the system

  SYNOPSIS

    who [-uTlHqnpdbrtasA] [file]

    who am i

    who am I

  FLAGS

    -A   Lists accounting information associated with login usage.  To use
         this flag, system accounting software must be enabled and the command
         must be invoked with the following string:

         who -A /etc/wtmp

         When using this string, the system will look for accounting
         information in the /etc/wtmp file.

    -a   Processes the /etc/utmp file or a named file with all flags turned
         on.

    -b   Indicates the time and date of the last reboot.

    -d   Displays all processes that have expired and have not been respawned
         by init.  The exit field appears for dead processes and contains the
         termination and exit values (as returned by the wait() function) of
         the dead process.  This can be useful in determining why a process
         terminated.

    -H   Displays column headings above the regular output.

    -l   Lists only those lines on which the system is waiting for someone to
         log in.  In such cases, the name in the name field is LOGIN.  Other
         fields are the same as for user entries, except that the state field
         does not exist.

    -n   Specifies the number of users per line; used only with the -q flag.
         Following the -n flag, the user must specify the number of columns
         the output should have.

    -p   Lists any other process currently active and previously spawned by
         init.  The name field contains the name of the program executed by
         init as found in /etc/inittab.  The state, line, and idle time fields
         have no meaning.  The comment field shows the ID field of the line
         from /etc/inittab that spawned this process.




  2/94 - Intergraph Corporation                                              1






  who(1)                              CLIX                              who(1)



    -q   Displays a quick version of who, displaying only the names and the
         number of users currently logged on.  When this flag is specified,
         all other flags are ignored.

    -r   Indicates the current run-level of the init process.  In addition, it
         produces the process termination status, process ID, and process exit
         status (see utmp) in the idle time, PID, and comment fields,
         respectively.

    -s   Lists the default options (the name, line, and time fields).

    -T   Lists the state of the terminal line in addition to the name, line,
         and time fields.  The state describes whether someone else can write
         to that terminal.  A plus sign (+) appears if the terminal is
         writable by anyone; a dash (-) appears if it is not.  The root
         directory can write to all lines having a plus sign or a dash in the
         state field.  If a bad line is encountered, a question mark (?) is
         displayed.

    -t   Indicates the last change to the system clock (with the date command)
         by root.  (See su.)

    -u   Lists only those users currently logged on.  The output displayed by
         who -u contains the following fields:

         Name   Lists the user's login name.

         Line   Lists the name of the line as found in /dev.

         Time   Lists the time the user logged in to the system.

         Idle time
                Lists the number of hours and minutes since activity last
                occurred on the user's line.  A dot (.) indicates that the
                terminal has seen activity within the last minute and is
                therefore ``current.''  If more than 24 hours have elapsed or
                the line has not been used since system boot, the entry is
                marked old.  This field is useful when trying to determine
                whether a user is working at a terminal.

         Process ID (PID)
                Lists the process ID of the user's shell.

         Comments
                Lists the comment associated with the user's line as found in
                /etc/inittab.  This field can contain information concerning
                the terminal's location, the telephone number of the dataset,
                the type of terminal if hard-wired, and so on.

         If a user logs in from a remote system using telnet or rlogin, the
         host name is listed in the last column of the displayed output.



  2                                              Intergraph Corporation - 2/94






  who(1)                              CLIX                              who(1)



  DESCRIPTION

    The who command lists the user's name, terminal line, login time, elapsed
    time since activity occurred on the line, and the process ID of the
    command interpreter (shell) for each UNIX system user currently logged on.
    The command examines the /etc/utmp file at login time to obtain the
    information it lists.  If a file is specified, that file, which must be in
    utmp format (see utmp(4)), is examined.  Usually, the specified file will
    be /etc/wtmp, which contains a history of all the logins since the file
    was last created.

    When the who command is used along with am i or am I, the system
    identifies the invoking user.

    The general format for output of the who command is as follows:

    name [state] line time [idle] [pid] [comments] [exit]

    The name, line, and time information is produced by all flags except -q;
    the state information is produced only by -T; the idle and PID information
    is produced only by -u and -l; and the comment and exit information is
    produced only by -a.  The information produced for the -p, -d, and -r
    system output flags are explained in the FLAGS section of this document.

  EXAMPLES

    1.  The following displays the invoking user's username, terminal, and
        login time:

        who am i


    2.  The following displays the processes waiting for a login and terminal
        state information; column headers are also displayed:

        who -TlH


    3.  The following lists only the usernames and the number of users:

        who -q


    4.  The following displays information about the current level:

        who -r


    5.  The following tells when the system was last booted:

        who -b



  2/94 - Intergraph Corporation                                              3






  who(1)                              CLIX                              who(1)



    6.  The following lists a quick version of the who command with output
        appearing in four columns:

        who -qn4


  FILES

    /etc/wtmp
    /etc/utmp
           User and accounting information.

    /etc/utmp2
           Information on users logged in from remote hosts.

    /etc/inittab
           Script for the init process.

  NOTES

    After a shutdown while in the single-user state, the who command returns
    to the prompt because the /etc/utmp file is updated only at login time and
    there is no login in the single-user state.  Thus, the who command cannot
    accurately report on this state.  However, the who am i, command returns
    the correct information.

    When using the who -A command to access accounting information, the system
    accounting software database must be loaded and the filenames or
    information should be included in the /etc/wtmp file.

  DIAGNOSTICS

    In order for the who am I diagnostic messages to be displayed, the user
    login must first be associated with a terminal.  When using the who am i
    command, there must be a controlling terminal when the command is issued.

  EXIT VALUES

    The who command exits with a 0 if successful, or with a nonzero value if
    an error occurs.

  RELATED INFORMATION

    Commands:  date(1), login(1), mesg(1), su(1), init(1)

    Functions:  wait(2)

    Files:  inittab(4), utmp(4)






  4                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026