The who command is used to determine the details of users currently logged in to a system. The output of the who command includes the user name, the name of the system from which the user is connected, and the date and time that the user has been connected since.
Syntax
The syntax of the who command is:
$ who [options]
For examples, who command without any options:
$ who geek console Sep 4 21:11 geek ttys000 Sep 5 19:36
who Command options
The -u option can be used to see how long users have been idle. A dot indicates that the users were active up to the last minute, old indicates that the users have been inactive for over 24 hours, and anything between 2 minutes and 23 hours 59 minutes shows the length of time they have been idle. The “am i” option displays information only for the user who runs the command.
$ who -u geek console Sep 4 21:11 old 131 geek ttys000 Sep 5 19:36 . 3874
$ who am i geek ttys000 Sep 5 19:36
who Command Examples
1. To see who is logged in:
# who
2. To see all the users logged in:
# who -a
3. To see last time of system boot:
# who -b
4. To see the dead processes:
# who -d
5. To see the column headings:
# who -H
6. To print system login processes:
# who -l
7. To print active processes spawned by init:
# who -p
8. To count the all logins:
# who -q
9. To print the current runlevel:
# who -r
10. To print system last clock change:
# who -t