Home » Linux » Basic Linux Commands » The “whoami” Command in Linux

The “whoami” Command in Linux

The whoami command in Linux is basically the concatenation of the strings “who”,”am”,”i” as whoami. It is used to enquire about the username of the current user who is logged into the system.

It is similar as running the id command with the options -un.

Simply type the ‘whoami’ on command prompt to find logged in user in current shell.

$ whoami

The above output shows that you are logged in with user ‘codebind’ in current shell.

The same details can be find with id -un command in Linux.

$ id -un

Options of whoami


$ whoami [OPTION]
  1. –help Option:

It gives the help message and exit.


$ whoami --help
Usage: whoami [OPTION]...
print the user name associated with the current effective user ID.
same as id -un.

2. –version Option:

It gives the version information and exit.


$ whoami --version
whoami (GNU coreutils) 8.30

Other Command That Are Related To whoami Command

There are few commands like:

  1. w Command:

The w command shows who is logged on and what they are doing. So you only have to type the command.

$ w
 15:32:22 up  3:18, 1 user, load average: 0.07, 0.02, 0.00
USER     TTY     FROM            LOGIN@   IDLE   JCPU   PCPU WHAT
codebind :0      :0              11:49   ?xdm?   6:46   0.02s /usr/lib/gdm3/g

2. who Command:

The who command will give you information about who is logged on the system. And you can type the command as in the below format.

$ who
codebind :0        2022-05-19 11:49 (:0)

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment