Whoami command in Linux

In this article, we will learn about how to find your username using the whoami command in Linux. As its name suggests, the whoami command prints the user name of the effective user ID. In other words, it displays the name of the currently logged-in user.

whoami Command in Linux

The syntax for the whoamicommand is this:

$ whoami [oprions]

To display the name of the currently logged user, if you are using the following command:

$ whoami

Whoami command in Linux

When you are switching to another user with the sucommand. You can verify using whoamicommand whether the user is logged in or not.

Whoami command in Linux

The whoamicommand can accept two arguments:

  • -h (–help) – Display this help and exit.
  • -V (–version) – Output version information and exit.

Conclusion

The whoami command is a compound of the words “Who am I?” and prints the name of the user associated with the current effective user ID.

If you have any questions, feel free to leave a comment.

Related Posts:

Leave a Comment