who Linux command
In this post, we will discuss the Linux who command and the whoami command. The first command is used to determine who logged into the system, and the second one is used to determine who is currently working on the system.
Syntax
The basic syntax of the command is as follows:
$ who [options]
The common options are as follows:
-H: Displays column headers.
-q: Prints a quick list of logged-in usernames with a total count of users.
-b: Shows the time of the last system boot.
-u: Displays the idle time of each user.
-a: Combines various options to show detailed information about all users.
who displays the user currently logged in to the computer screen. To display help and command line switches type
$ who –help
To know and learn all the command line options type:
$ man who
whoami command
whoami Linux command displays the current effective username to the computer screen. Sometimes when we switch users to another user using the su command. This command would be useful to know the effective username.
To know and learn all the command line options type:
$ man whoami
For example, if john logs into the system and switched to bob user account . who would display john and whoami would display bob.
Example
$ whoami testingdocs $ su oracle Password: $ whoami oracle $
Linux Commands
Linux Basic Commands Tutorial page:
More Information on Ubuntu Linux: