In GNU Coreutils, whoami prints the username associated with the process’s current effective user ID. Run whoami in a terminal to see that name; for GNU Coreutils, id -un gives the equivalent result. The name reflects the effective identity, not necessarily the account that originally logged in.
What does whoami do?
The GNU Coreutils manual defines the command this way: “whoami prints the user name associated with the current effective user ID.” See the GNU Coreutils whoami documentation.
The effective user ID is the identity the process is currently operating under for permission checks. As a result, the displayed username depends on the system and the context in which the command runs. The output is not guaranteed to be the same as the name of the account that started the session.
Basic whoami command examples
Print the effective username
whoami
Run this command in a shell. It prints the username associated with that process’s current effective user ID. The exact output varies by machine and execution context.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
Use GNU’s equivalent command
id -un
GNU documents id -un as equivalent to whoami: it prints the username for the effective user ID. See the GNU Coreutils id documentation.
Display help or version information
whoami --help
whoami --version
GNU Coreutils documents --help and --version as the command’s options. The GNU whoami manual entry does not document other options.
whoami vs. who vs. id -un
| Command | What it reports |
|---|---|
whoami |
The username associated with the current effective user ID, in GNU Coreutils. |
id -un |
The GNU-documented equivalent of whoami. |
who |
Users currently logged on and their login details, according to GNU documentation. |
Use whoami to check the effective username for the command’s process. Use who when you want information about logged-on users; it answers a different question. See the GNU Coreutils who documentation.
Exit status
GNU Coreutils specifies that a zero exit status means whoami succeeded, while a nonzero status means it failed. This is useful in shell scripts when checking whether the command ran successfully; the status indicates success or failure, not the identity itself.
Recommended Free Tools
Platform scope
The options and equivalence described here are documented for GNU Coreutils 9.11. Identical behavior and options across BSD, macOS, commercial Unix, and other non-GNU implementations are not established here; consult the manual for the specific system when portability matters.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

