Skip to content

The whoami command

The whoami command prints the name of the user you are logged in as.

A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.

Usage

whoami

Print your user name. Prints the name of the user you are logged in as.

How to use whoami

Check your user name

Useful after su or sudo -i, or in scripts that must not run as root.

whoami
learner
echo $USER
learner

Questions about whoami

What is the difference between whoami and id?

whoami prints only the name. id also prints your user number and the groups you belong to.

Every everyday command on one page, to print or keep open: the Linux commands cheat sheet.