Linux whoami Command

Introduction

whoami is a command which the user name associated with the current effective user ID. This command similar to running id command with -un option.

whoami Syntax


       whoami [OPTION]...

Getting help for whoami

To get help for whoami we can run the command below.


whoami --help

We can also read manpage and infopage for whoami by running the command below.


man whoami

info whoami

Invoking whoami

to run whoami, we can just run whoami with no option, it will print our username. For example:


$ whoami
howtodojo

Linux whoami Command Source Code

You can find whoami command source code from the folowing repositories:

  • w command in Linux
  • id command in Linux
  • who command in Linux

Summary

In this tutorial we learn how to use whoami in Linux with practical examples. Visit our Linux Commands guide to learn more about using command line interface in Linux.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.