WHOAMI Command in Linux – Prints the Username

whoam command in Linux

whoami is a Linux/Unix command which prints the username associated with the current effective user ID. It is written by Richard Mlynarik and is part of GNU Coreutils. For complete documentation, run: info coreutils.

Syntax

whoami [OPTION]…

Options

  • –help:- Print help
  • –version:- Display version information

WHOAMI Command( Examples)

Check below for additional examples

1. Print the username

Just enter the command without any option/parameter to display the username for the current userid as shown below.

$ whoami
atech

2. Display Help

–help option displays help about the whoami and exit

$ 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

Report whoami bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'whoami invocation'

3. Print Version

–version displays version information and exit

$ whoami --version
whoami (GNU coreutils) 8.4
Copyright (C) 2010 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.

Summary

The whoami command is helpful for DBAs/Admins working on multiple instances to know the current username they are logged in to. Just type the command on the shell prompt and it will tell you the current user name as shown below.

$ whoami
atech

 

Share This: