How to Check the Current User in Linux (whoami)
whoami prints the username of the currently logged-in user running the shell.
Published October 2, 2026
whoami prints the username of the currently logged-in user running the shell.
Key points
- Useful in scripts to confirm they're running as the expected user before performing privileged actions
- id gives more detail than whoami, including the user's numeric UID/GID and group memberships
Example
whoami