The whoami command

Yaser Rahmati | یاسر رحمتی

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

[root@academy ~]# whoami --version
whoami (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Richard Mlynarik.
[root@academy ~]#

Last updated