Javatpoint Logo
Javatpoint Logo

"Who" command in Linux

Who command in Linux

In this tutorial, we will discuss Linux's "Who" command and also learn how it works.

Introduction

The Linux "who" command lets you display the users currently logged in to your UNIX or Linux operating system.

Whenever a user needs to know about how many users are using or are logged-in into a particular Linux-based operating system, he/she can use the "who" command to get that information. This command is straightforward to use, and it displays a variety of essential information about all users who are currently logged-in into the system. In most Linux operating systems, there is a similar command known as "w" which does almost the same thing. The "w" command displays information about all users logged into the current system. In addition, it also displays additional data along with some statistical data. The basic "who" command with no command-line arguments show only the names of users that currently logged-in into the system. In many cases, it may also show some additional information, such as what the terminals they are logging into and the time they logged in, however it depends entirely on the systems used by users.

The output of the "who" command usually depends on the users and how they use it. If a user normally types the "Who" command in the terminal and runs it, the output will be the same. It will display the list of the users that are currently logged in to the current operating system. However, if the user runs or uses the "who" command with different arguments, then the output will also be slightly changed or may completely different.

Let's see what output we will get if we run the "who" command without any additional options or arguments.

The information shown or displayed through this command depends on how you are using this command. If you are using this command without any option or argument, it will display only a small amount of information based on the following points:

  1. Time of last system boot
  2. Current run level of the system
  3. List of logged-in users and more

Let see the syntax of the "Who" command without including any arguments:

Syntax of the command:

How to run the "who" command in Linux?

The following steps will help you to run the above command even if someone is not familiar enough with Linux operating systems (or new to the Linux Operating system):

Step 1. Open the terminal by pressing the Ctrl + Alt + T on the keyboard, as shown in the given image:

Who command in Linux

Step 2. Now, type the following given command in the terminal and press enter:

Command:

Step 3. Once you press the enter button, it will take a little bit time and display the information like logged-in users' names, last reboot time,, etc. The output of this command may look like as given in the following image:

Output

Who command in Linux

We can notice in the above-given image, only one user currently logged in into our system. Thus it displays the information only about the current user. However, if you are using a system to which several other users have access, the above command will display all users logged in to the system.

"Who" command with the different arguments

Now let's see how to use the "who" command with different options or arguments to display different types of information about different things. Here we will briefly discuss "who" with all its useful options, arguments and also see their practical implementation.

1. Command to display the hostname and user associated with the input/output devices like a keyboard-

Syntax

Output

Who command in Linux

2. To display all details of currently logged in users-

With this command's help, one sees all the details of every user logged in to the current system. The syntax of this command is the same except the additional option "-a", as we can see in the given syntax:

Syntax

Output

Who command in Linux

Or

You can use "who -all" instead of "who -a" as it displays all information.

Syntax


Who command in Linux

3. To display information about all active processes that are spawned by the NIT process-

This command will help you to display essential information as well as each and every active process.

Syntax

Output

Who command in Linux

4. To display the status of the user's message as -, + or?

This command will help us to display the status of the user's message. Syntax of this command given below:

Syntax

Output

Who command in Linux

5. To display the whole list of logged-in users-

This command will help us to display the whole list of the logged-in users. Syntax of this command given below:

Syntax

Output

Who command in Linux

6. To display the whole list of dead processes-

One can use this command to see the complete list of all dead processes. The syntax of the command given below:

Syntax

Output

Who command in Linux

7. To display system login process details-

One can use this command to see the login process. The syntax of the command is given below:

Syntax:

Output

Who command in Linux

8. To count the numbers of all logged-in users-

We can use this command to see how many users logged in in the form of numbers. The syntax of the command is given below:

Syntax:

Output

Who command in Linux

9. To display the current run level of the system-

The syntax of the command is given below:

Output

Who command in Linux

10. To display the system's username-

This command is generally used to know about the actual system's username. The syntax of the command is given below:

Syntax

Output

Who command in Linux

11. To display the list of users and their activities-

With the help of this command, you can see the complete list of users and their activities as well, which are logged-in the current system. The command is given below:

Syntax

Output

Who command in Linux

12. To display user identification information-

One can use this command to see the user identification information. The syntax of the command is given below:

Syntax

Output

Who command in Linux
Next TopicLinux Server




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA