Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

whoami command in Linux with example

  • Difficulty Level : Basic
  • Last Updated : 18 Feb, 2021

whoami command is used both in Unix Operating System and as well as in Windows Operating System.

  • It is basically the concatenation of the strings “who”,”am”,”i” as whoami.
  • It displays the username of the current user when this command is invoked.
  • It is similar as running the id command with the options -un.

The earliest versions were created in 2.9 BSD as a convenience form for who am i, the Berkeley Unix who command’s way of printing just the logged in user’s identity. The GNU version was written by Richard Mlynarik and is part of the GNU Core Utilities (coreutils).

Syntax:

geekforgeeks@HP~: whoami

Output :

geekforgeeks

Example :
file1



Options of Whoami

Syntax:

geekforgeeks@HP~: whoami [OPTION]

1. –help Option :
It gives the help message and exit.
Syntax :

geekforgeeks@HP~: whoami --help

Example :
file2
2. –version Option :
It gives the version information and exit.
Syntax:

geekforgeeks@HP~: whoami --version

Example :
file3

Commands related to whoami command are as follows :
1. w — Show who is logged on and what they are doing.
2. who — Report which users are logged in to the system.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!