The whoami command is used in the terminal to quickly check the username of the currently logged-in user. Here’s how to use it:
Steps to Use whoami:
-
Open Terminal: Launch your terminal application on your Unix-like operating system (Linux, macOS, etc.).
-
Type the Command: Enter the following command:
whoami -
Press Enter: Hit the Enter key to execute the command.
-
View Output: The terminal will display the username of the current user.
Example:
$ whoami
john
In this example, "john" is the username of the user currently logged into the terminal session.
Use Cases:
- Verifying User Identity: Useful when you need to confirm which user account you are operating under, especially in environments with multiple users.
- Scripting: Can be included in scripts to check or log the current user for auditing or permission checks.
That's how you can use the whoami command effectively!
