NAME
     who - who is on the system

SYNOPSIS
     who [ -uTlHqpdbrtas ] [ filename ]

     who -qn x [ filename ]

     who am i

     who am I

AVAILABILITY
     SUNWcsu

DESCRIPTION
     who can list 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
     current  UNIX  system  user.   It examines the /var/adm/utmp
     file to obtain its information.  If filename is given,  that
     file  (which  must  be in utmp(4) format) is examined.  Usu-
     ally, filename will be /var/adm/wtmp, which contains a  his-
     tory of all the logins since the file was last created.

     who with the am i or am I  option  identifies  the  invoking
     user.

     The general format for output is:

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

     The name, line, and time  information  is  produced  by  all
     options 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 - p,   - d,  and   - r  is
     explained during the discussion of each option, below.

OPTIONS
     With options, who can list  logins,  logoffs,  reboots,  and
     changes  to  the  system  clock,  as well as other processes
     spawned by the init process.  These options are:

     -u         This  option  lists  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 (see inittab(4)).  This can  contain
               information  about  where the terminal is located,
               the telephone number of the dataset, type of  ter-
               minal if hard-wired, and so forth.

     -T         This option is the same as the -s option,  except
               that  the  state  of the terminal line is printed.
               The 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.   root  can write to all lines having a ` + '
               or a ` - ' in the state field.  If a bad  line  is
               encountered, a ` ? ' is printed.

     -l         This option 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         This option will print column headings above  the
               regular output.

     -q         This is a quick who , displaying only  the  names
               and the number of users currently logged on.  When
               this  option  is  used,  all  other  options   are
               ignored.

     -p         This option lists  any  other  process  which  is
               currently  active  and has been previously spawned
               by init . The name field is the name of  the  pro-
               gram  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.  See
               inittab(4).

     -d         This option  displays  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(3B)), of the dead process.  This can be  use-
               ful in determining why a process terminated.

     -b         This option indicates the time and  date  of  the
               last reboot.

     -r         This option indicates the  current  run-level  of
               the  init  process.   In addition, it produces the
               process termination status, process id,  and  pro-
               cess  exit  status  (see  utmp(4)) under the idle,
               pid, and comment headings, respectively.

     -t         This option indicates the last change to the sys-
               tem  clock  (via  the  date command) by root . See
               su(1M) and date(1).

     -a         This option processes /var/adm/utmp or the  named
               filename with all options turned on.

     -s         This option is the default  and  lists  only  the
               name, line, and time fields.

     -nx        This option takes a numeric  argument,  x,  which
               specifies the number of users to display per line.
               x must be at least 1.  The -n option must be  used
               with -q.

     Note to the super-user:  after a shutdown to the single-user
     state,  who  returns  a  prompt;  the  reason  is that since
     /var/adm/utmp is updated at login time and there is no login
     in  single-user  state, who cannot report accurately on this
     state.  who am i , however, returns the correct information.

ENVIRONMENT
     If any  of  the  LC_*  variables  (  LC_CTYPE,  LC_MESSAGES,
     LC_TIME,  LC_COLLATE,  LC_NUMERIC,  and  LC_MONETARY  ) (see
     environ(5)) are not set in the environment, the  operational
     behavior  of  who  for each corresponding locale category is
     determined by the value of the  LANG  environment  variable.
     If LC_ALL is set, its contents are used to override both the
     LANG and the other LC_* variables.  If  none  of  the  above
     variables  is  set in the environment, the "C"  (U.S. style)
     locale determines how who behaves.

     LC_CTYPE
          Determines how who handles characters. When LC_CTYPE is
          set  to  a valid value, who can display and handle text
          and filenames  containing  valid  characters  for  that
          locale.  who  can display and handle Extended Unix Code
          (EUC) characters where any individual character can  be
          1,  2, or 3 bytes wide. who can also handle EUC charac-
          ters of 1, 2, or more column widths. In the "C" locale,
          only characters from ISO 8859-1 are valid.

     LC_TIME
          Determines how who handles date and time  formats.   In
          the "C" locale, date and time handling follows the U.S.
          rules.

FILES
     /sbin/inittab
     /var/adm/utmp
     /var/adm/wtmp

SEE ALSO
     date(1),  login(1),  mesg(1),  init(1M),  su(1M),  wait(3B),
     inittab(4), utmp(4), environ(5)