whoami Command: Find the Current User in Linux

Find information about your current Linux user account

What to Know

  • Type whoami to display the current username. If whoami isn't installed, type id -un.
  • More id commands: Show user ID without username = id -u. Show effective group ID = id -g. Show group name = id -gn.
  • Show every group ID the user belongs to = id -G. Show every group name the user belongs = id -Gn.

This article explains how to use the whoami and id commands to find the user account you're logged into, group IDs, and group names. Also included are instructions for using the --help switch and how to view the current version of whoami or id.

Person using Linux on a laptop
Lifewire / Elise Degarmo 

Use whoami to Display Your Username

To use the terminal window to display the user you're actively logged in as, type the following command:


The output of the above command shows the current user, like this:


To quickly see how this works with another user account (if you haven't made any other users in Linux), use the sudo command to log in as root:

sudo su

Then, if you run the whoami command again, you'll be told that you're root.

How to Do It With id -un

In a strange circumstance where whoami isn't installed, there is another command you can use to display your current username.

id -un

The result is exactly the same as the whoami command, so in this example, it would display jacob.

The id command can show more than the current user. It can also show the user id, group id, and groups to which the user belongs. For example, to show only the effective group the user belongs to, type the following:

id -g

The above command only shows the group id. It doesn't show the group name. To show the effective group name, execute this command:

id -gn

You can display every group id that a user belongs to by entering this:

id -G

The above command only shows the group ids. You can also use the Linux id command to display the group names:

id -Gn

If you want to display your user id without the username, run the following command:

id -u

More Information

You can use the --help switch with either whoami or id to find the current man page for each program.

id --help
whoami --help

To see the current version of id or whoami, use the following commands:

id --version
whoami --version
Was this page helpful?