Build a Better Process

Linux whoami Command Summary with Examples

Linux whoami allows you to display the current user's name.
  1. Purpose - Learn what whoami is for an how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with whoami.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
In this tutorial on Linux whoami, 13 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / whoami-command.html

An ad-free and cookie-free website.

Examples of the Linux whoami Command


Learn to find your user id at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux whoami Command Summary with Examples (3:39)

Video Script

The Command and Why You Need It

Our thirteenth word, or command to memorize is whoami from the category Users.

whoami allows you to display the current user's name. Recall from our last video, we created the alias lsd, and that led us to kick off this, our first discussion on users. And with that as an opener...

Common Linux whoami Options
-options description
--help Print help screen
--version Show version information

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The whoami command has 2 options and no arguments, so it's one of the simplest commands we'll cover.

We'll touch on the self-explanatory double-dash options shortly (--help and --version).

So why is whoami an important command? Well, for those with multiple identities, like system administrators, whoami provides a quick command offering an opportunity for self-reflection. And now you know how to do that.


Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go, type whoami.

$ whoami paul

And look, the computer knows me by my name paul. Isn't that nice? Well, actually, Linux translates every user into a numeric userid called a UID, which we'll explore later.

Next, the --help option.

$ whoami --help Usage: whoami [OPTION]... Print the user name associated with the current effective user ID. Same as id -un. --help display this help and exit --version output version information and exit GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Full documentation at: <http://www.gnu.org/software/coreutils/whoami> or available locally via: info '(coreutils) whomi invocation'

And this offers an introduction to an advanced command to be discussed later, called id.

And at this point, I'd like to draw your attention to a common option, used across many commands, the double-dash --version.

$ whoami --version whoami (GNU coreutils) 8.23 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Richard Mlynarik.

Pretty easy huh? As you can tell, I wanted to approach the topic of users slowly, because often the subject is best left to the experts.

A Final Tip

Okay now you know how to use whoami. And you know the syntax for commands, options and arguments.

One last tip about the whoami command. So whoami is the second of the who, what, where, when, why, how questions offering perspective that we cover here. Can you guess what command comes next?

Okay, thanks for visiting today. I hope this was a fun introduction to the whoami command.

Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:

What's Next?

If you like to learn, connect at YouTube, Twitter and at our no-spam email list.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / whoami-command.html

Linux whoami command
unix whoami examples
linux whoami tutorial
linux whoami examples
linux who am i
who am i command
linux user id
user management in linux
shell whoami
terminal whoami
find your user id
linux uid

A newly-updated free resource. Connect and refer a friend today.