How is it used?

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:

  1. Open Terminal: Launch your terminal application on your Unix-like operating system (Linux, macOS, etc.).

  2. Type the Command: Enter the following command:

    whoami
  3. Press Enter: Hit the Enter key to execute the command.

  4. 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!

0 Comments

no data
Be the first to share your comment!