Check the current identity
Compare the name with the numeric identity. Names are readable; a UID helps diagnose permissions.
whoami prints the user name tied to the process's effective user ID — the account you act as now.
whoami
effective user
id -u
numeric UID
id -un
same user name
whoami --help
help
whoami resolves the process’s effective user ID to an account name. It
identifies the account used for this command, not the owner of the terminal
window.
A normal student session reports student. An authorised sudo invocation may report
a different account. The command neither lists groups nor establishes who
originally logged in. It does not obtain its answer from USER, an environment
variable that can differ from the process credentials.
There are no operational options: the plain invocation does the job. The golden
version provides only --help and --version. Do not pass another user name as
an operand; use id student for that account. Success returns zero; inability to
resolve the name is an error.
| Option | What it does | Example |
|---|---|---|
--help |
Display help and exit. | whoami --help |
--version |
Report the coreutils version when comparing implementations. | whoami --version |
Nothing found. Try a shorter query.
Compare the name with the numeric identity. Names are readable; a UID helps diagnose permissions.
The training VM permits sudo. This identifies the account for one command; it does not turn the current shell into a root shell.
Use id to inspect student; whoami does not accept a user operand.
whoami has no target-user argument. Remove it for the current identity or use id
for another account.
Check whether you are in a privileged shell. Changing USER or file permissions does not correct the execution context.
The numeric identity may lack an accessible account entry. Inspect the UID and its account mapping before creating or changing accounts.
The command only reads information. A root result is not permission to make administrative changes. In automation, check the exit status and do not use USER as proof of privileges.
users-groups — UIDs, groups, and accounts.
sudo — changing execution identity.
processes — process identities.
Found an inaccuracy? Report an error in the article