whoami is a Linux/Unix command which prints the username associated with the current effective user ID. It is written by Richard Mlynarik and part of GNU Coreutils.
For complete documentation, run: info coreutils ‘whoami invocation’
–help:- Print help –version:- Display version information
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
It is an external command. Executable location is /usr/bin. You can find it using the type -a command as shown below.
$ type -a whoami whoami is /usr/bin/whoami
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.