In the Linux operating system, the “whoami” command is a simple utility that displays the username of the currently logged-in user. It is a basic and frequently used command-line tool that provides information about the user’s identity on a Linux system.
It is an abbreviation for “who am I”.
The command is written by Richard Mlynarik and is part of GNU Coreutils. For complete documentation, run: info coreutils.
- –help:- Print help
- –version:- Display version information
WHOAMI Command( Examples)
Check below for additional examples
1. Print the username in Linux
Just enter the whoami command without any option/parameter to display the username for the current userid as shown below.
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.
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.