Identifies the users currently logged in.
who [ -a | -b -d -i -l -m -p -q -r -s -t -u -w -A -H -T -X ] [ File ]
who am { i | I }
The who command displays information about all users currently on the local system. The following information is displayed: login name, tty, date and time of login. Typing who am i or who am I displays your login name, tty, date and time you logged in. If the user is logged in from a remote machine, then the host name of that machine is displayed as well.
The who command can also display the elapsed time since line activity occurred, the process ID of the command interpreter (shell), logins, logoffs, restarts, and changes to the system clock, as well as other processes generated by the initialization process.
The general output format of the who command is as follows:
Name [State] Line Time [Activity] [Pid] [Exit] (Hostname)
where:
| Name | Identifies the user's login name. |
| State | Indicates whether the line is writable by everyone (see the -T flag). |
| Line | Identifies the line name as found in the /dev directory. |
| Time | Represents the time when the user logged in. |
| Activity | Represents the hours and minutes since activity last occurred on that user's line. A . (dot) here indicates line activity within the last minute. If the line has been quiet more than 24 hours or has not been used since the last system startup, the entry is marked as old. |
| Pid | Identifies the process ID of the user's login shell. |
| Term | Identifies the process termination status (see the -d flag). |
| Exit | Identifies the exit status of ended processes (see the -d flag). |
| Hostname | Indicates the name of the machine the user is logged in from. |
To obtain information, the who command usually examines the /etc/utmp file. If you specify another file with the File parameter, the who command examines that file instead. This new file is usually the /var/adm/wtmp or /etc/security/failedlogin file.
If the File parameter specifies more than one file name, only the last file name will be used.
This command returns the following exit values:
| 0 | Successful completion. |
| >0 | An error occurred. |
whoInformation similar to the following is displayed:
pts/1 Nov 9 00:20 long_username_greater_than_eight_characters (localhost)
who am i
Information similar to the following is displayed:
george lft/0 Jun 8 08:34
who /var/adm/wtmp
Information similar to the following is displayed:
hank lft/0 Jun 8 08:34 (ausnix5) john lft/0 Jun 8 08:34 (JIKey) mary lft/0 Jun 8 08:22 (machine.austin.ibm) jan pts4 Jun 8 09:19 (puff.wisc.edu)
. run-level 2 Jun 8 04:15 2 0 s
srcmstr . Jun 8 04:15 old 2896 cron . Jun 8 04:15 old 4809 uprintfd . Jun 8 04:15 old 5158
. system boot Jun 19 10:13 . run-level 2 Jun 19 10:13 . . Jun 19 10:14 old . . Jun 19 10:14 old . . Jun 19 10:14 old rc - . Jun 19 10:13 old . . Jun 19 10:16 old . . Jun 19 10:14 old srcmstr - . Jun 19 10:14 old rctcpip - . Jun 19 10:14 old rcdce - . Jun 19 10:14 old rccm - . Jun 19 10:15 old dceupdt - . Jun 19 10:15 old rcnfs - . Jun 19 10:15 old cron - . Jun 19 10:16 old piobe - . Jun 19 10:16 old qdaemon - . Jun 19 10:16 old writesrv - . Jun 19 10:16 old uprintfd - . Jun 19 10:16 old . . Jun 19 10:16 old LOGIN - lft0 Jun 19 10:16 old . . Jun 19 10:16 old . . Jun 19 10:16 old
The date command.