Linux Commands: whoami
In this guide, we will explore the whoami
command, which is used to print the current user name. This command works on Linux, macOS, WSL, and any UNIX environment.
How to Use the whoami
Command
To print the user name currently logged in to the terminal session, simply type whoami
and press Enter. Here’s an example:
1 | $ whoami |
Note: The
whoami
command should not be confused with thewho am i
command, which provides more detailed information.
Now you know how to use the whoami
command to quickly retrieve the current user name. Give it a try on your own system and see the result!
tags: [“Linux commands”, “whoami”, “UNIX environment”, “terminal session”]