/ factorpad.com / tech / linux-essentials / whoami-command.html
An ad-free and cookie-free website.
Beginner
Learn to find your user id at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux whoami Command Summary with Examples (3:39)
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...
-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
.
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.
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
.
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.
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.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
If you like to learn, connect at YouTube, Twitter and at our no-spam email list.
alias
command,
hit Back.whereis
command, click Next./ factorpad.com / tech / linux-essentials / whoami-command.html
A newly-updated free resource. Connect and refer a friend today.