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 infoshow 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 timeshow 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 userslist 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 permissioncheck 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 processshow 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 infoshow 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 processall 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 runlevelcurrent runlevel

The post How to Use the Who Command in Linux appeared first on Hongkiat.

from Signage https://ift.tt/Vrxb7kc
via Irvine Sign Company

from Signage https://ift.tt/oUrOxpF
via Irvine Sign Company