Linux Komutları

Linux who, w and whoami Command

Linux who, w and whoami Command

who command is used to determine when the system has booted last time, a list of logged-in users, and the system's current run level.

w command displays user information like user id and activities on the system. It also gives the knowledge of the system's running time along with the system load average.

As the name describes, the whoami command is used to print the user's name from which they are currently logged-in.

who Command

To display the login name of the user, type the “who” command in the terminal:

$ who

To get the status of users messages, type the below-mentioned Command:

$ who -T -H

-b option is used to show when the system boots last time. So, to check its boot time, use the given Command:

$ who -b -H

To display a list of all dead processes in the system, use the -d option with the “who” command in the terminal.

Type the given Command in command-line:

$ who -d -H

(In my case, there's no dead process).

To get the current run level of the system, run the “who” command with the “-r” option in the terminal:

$ who -r

The -q option is used to display the count of currently logged-in users with the user name. To check it, type:

$ who -q -H

w Command

Run w command in terminal and get the list of users with activities. To display the output, use:

$ w

First-line displays the following output:

16:36:03 - the current time of the system

up 43 min - System's uptime

1 user - Number of active users

0.17, 0.14, 0.05 - It displays the system load in which many tasks are running or waiting for disk I/O

Second-line displays:

USER - Name of active users

TTY - Terminal name

FROM - Hostname

[email protected] - Logged-in time

IDLE - User interaction time with terminal

JCPU - Time taken to attached processes with TTY

PCPU - Current process time used by the user

WHAT - The current process of user and arguments

whoami Command

Type the “whoami” command in the terminal to get the name of the user's identity:

$ whoami

whoami command has two flags:

  1. Help (-help)
  2. Version (-version)

1. Help
Help command in “whoami” displays help message and then exit it. So, type the following command in the terminal:

$ whoami --help

2. Version
Version command displays the version information of “whoami” and then exit.

Run the given command to check how it works:

$ whoami -version

Conclusion

The guide has shown a detailed note on who, w, and whoami commands.

The who command gives you information about which user is logged in to the system. We have seen how the w command works as it displays users' details along with activities. Finally, we have checked the working of the whoami Command used to display the user's identity.

How to download and Play Sid Meier's Civilization VI on Linux
Introduction to the game Civilization 6 is a modern take on the classic concept introduced in the series of the Age of Empires games. The idea was fai...
How to Install and Play Doom on Linux
Introduction to Doom The Doom Series originated in the 90s after the release of the original Doom. It was an instant hit and from that time onwards th...
Vulkan for Linux Users
With each new generation of graphics cards, we see game developers push the limits of graphical fidelity and come one step closer to photorealism. But...