That's a great question! While whoami is the simplest way to see your username, Linux provides several other commands that give you more detailed information about your identity.
Here are the most common ones:
1. id (The most detailed)
The id command shows your username, your unique User ID (UID), and the groups you belong to.
id
Output example:
uid=1000(labex) gid=1000(labex) groups=1000(labex),27(sudo)...
- uid: Your unique user number.
- gid: Your primary group ID.
- groups: All the groups you are a member of (this determines what permissions you have).
2. who
The who command shows who is currently logged into the system. It's useful on servers where multiple people might be working at the same time.
who
3. w
The w command is like a "super" version of who. it shows who is logged in and what they are currently doing (what command they are running).
w
4. groups
If you only want to know which groups your user belongs to without the ID numbers, you can use:
groups
Summary Table:
| Command | What it tells you |
|---|---|
whoami |
Just your username |
id |
Your username, UID, and all group memberships |
who |
List of all users currently logged in |
w |
Who is logged in and what they are doing |
Since you've already mastered whoami, feel free to try running id in your terminal to see the difference! It will give you a sneak peek into "Groups," which is what we will explore later in this lab.