The whoami command

The whoami command displays the username of the current effective user. In other words it just prints the username of the currently logged-in user when executed.

To display your effective user id just type whoami in your terminal:

[root@academy ~]# whoami
root
[root@academy ~]#

Syntax:

whoami [-OPTION]

There are only two options which can be passed to it :

  • --help: Used to display the help and exit

[root@academy ~]# whoami --help
Usage: whoami [OPTION]...
Print the user name associated with the current effective user ID.
Same as id -un.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'whoami invocation'
[root@academy ~]#
  • --version: Output version information and exit

Last updated