who Command in Linux operating system with examples

who Command in Linux

In this article, we are going to show you that how to Use the who Command in Linux. If you want to learn basic of the who Command in Linux then this article is ideal for you.

The Linux command who displays or print a list of currently logged in users into the system. It is also show the current run level, time of the last system boot and many more. The who command is similar to the command w , which is display the same details but also displays additional information and statistics.

Linux is an operating system, like Windows OS, iOS, and Mac OS. Linux is one of the most popular operating system on the planet, Android is also powered by Linux OS(operating system). An operating system is software that manages all hardware resources associated with desktop or laptop. In simple words, the OS(operating system) manages communication between software and hardware.

who Command in Linux

In the, the basic syntax of the who command is show as below:

who [OPTION]... [ FILE | ARG1 ARG2 ]

When you used who command without any argument, then the output looks something like below:

$ who
Output

root     pts/0        2021-01-03 13:30 (ip-address-here)
mkk    pts/1        2021-01-03 13:30 (ip-address-here)

In above output list, each line contains four fields :

  • 1st field contains the name of the logged user.
  • 2nd field contains the user’s terminal Line.
  • 3rd field contains the time when the user logged in the system.
  • 4th field contains the hostname or IP address from where the user is logged in.

When you use who command with two arguments, then the who command displays the information of the current user.

$ who am i
output

mkk    pts/1        2021-01-03 13:31 (ip-address-here)

Use  -b--boot option to display the time of last system boot :

$ who -b
output

         system boot  2020-12-25 10:20
$ who -d
$ who -r
output

         run-level 5  2021-01-03 13:32

Use -q--count option to print the user names and number of user currently logged in :

$ who -q
output

mkk
# users=21

To display active processes spawned by init, use -p option :

$ who -p

Use -t option to display last system clock change :

$ who -t

To display system login processes, use -l option :

$ who -l

That’s all

If you find any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top