How to use the whoami command

In this article, you will learn about the whoami command.

whoami command is a command which you can use for getting the current user name. But It is the concatenation of the who , am and i as whoami.
Also, there is a similar command as the id command with the -un option.

How To Get The Help For The whoami Command

If you want to get help with the whoami command then you can type the below command.

whoami --help

And you can see the below output.

whoami –help command output

Also, you can get the version of the whoami command using the below option

whoami --version
whoami command
whoami –version command output

Syntax Of The whoami Command

Also, you can see the syntax below.

whoami [option]

How To Use The whoami Command

So if you want to get the current user then you can type in the below format


And you can see the below picture for the output

whoami command output

Other Command That Are Related To whoami Command

There are few commands

What is the w command?

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


The output of the above command, you can see in the below picture.

w command output

How To Use 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.

whoami command
who command output

How To Use who am i command

With who am i the who command will display only the line pointing to your current session. So you can type as below.

 who am i

Also the output of who am i, you can see as the below

who am i command output


In this tutorial, you learned to use the w, who am i, and whoami commands. If you have any questions then you can ask in the comment section. Also, if you find it useful then you can share it over Facebook, WhatsApp, or other media.

Also, you may use the below commands. So learn it.

Leave a Reply