whoami command
Print the current user name.
- System information
- Package coreutils
- 3 options · 4 examples
Syntax
whoamiProvided by the coreutils package. Run man whoami for the full manual.
Common options
| Option | What it does |
|---|---|
id | Also show the UID, GID and groups |
who | Users logged in now |
w | Logged-in users and what they run |
Examples
Current user
whoamiUser and groups
idCheck if a script runs as root
[ "$(id -u)" -eq 0 ] || { echo "Run as root"; exit 1; }Who is logged in
w
No example matches. Check the options table or search the guides.
whoami guides
- whoami Command in Linux (Find Logged In User) Linux Commands · Updated Apr 2025
