How to Use the Who Command in Linux

The “who” reveals users who is currently logged in the system. It shows some information such as the username, the timestamp, and the IP address.

General syntax for who command:

$ who [OPTIONS...]
Show all users’ information
who -a

The -a option allows you to see all the details of each user logged into the current system.

Example: Entering the who -acommand and getting the output of all the information about the users on the system

show al users info
Show system’s last boot time
who -b

Use the who command with the -b option to print the last boot time of the system.

Example: After using the command, the output will print the message “system boot,” next to which the date and time are displayed.

show last boot time
List all logged in users
who -q

The -q option displays a list of usernames and the number of users currently logged on to the system.

Example: Entering the command and see the users logged in and their current number

list all logged in users
Check user’s write permission
who -T

Use the -T option to display the user’s post status. This will help you check the permissions to write messages to the terminal.

Example: Let’s type the who -T command to display user statuses in the terminal.

check users permission
Show all dead processes
who -d

This command allows you to get a complete list of all dead processes.

Example: Typing the who command with the -d option to show details of all dead processes. Note: No dead processes in this case.

show all dead process
Show information about current user
who -m

The -m option displays the hostname and user associated with I/O devices such as keyboards.

Example: Let’s run the who -m command to see how this command works.

show current user info
Show all active processes spawned by INIT process
who -p

Use the -p option to show a list of active processes spawned by init (background process which starts other processes).

Example: Entering the command with the -p option to get a list of processes. Note: No active processes in this case.

all active INIT process
Show current runlevel
who -r

To display the current runlevel of the system, use the -r option.

Example: Executing the who -r command to get information about the system runlevel

current runlevel