That's a great question! It shows you're thinking beyond the current step.
Besides whoami, here are a few other common user-related commands that are very useful in Linux:
-
id: This command displays detailed information about the current user (or a specified user), including their user ID (UID), group ID (GID), and all the groups they belong to.- Example:
id - Output:
uid=1000(labex) gid=1000(labex) groups=1000(labex),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)(Your output might vary slightly)
- Example:
-
who: This command shows who is currently logged on to the system. It can display username, terminal line, login time, and more.- Example:
who - Output:
labex tty1 2024-07-30 08:30 (:0)(Shows current login sessions)
- Example:
-
w: Similar towho, this command shows who is logged on and what they are doing. It includes load average information as well.- Example:
w
- Example:
-
users: This is a simpler command that just lists the usernames of the users currently logged in.- Example:
users - Output:
labex
- Example:
-
passwd: This command is used to change a user's password. If run without arguments, it changes the password for the current user.- Example:
passwd(It will then prompt you to enter the current password, then the new password twice)
- Example:
These commands provide different perspectives on user information and activity on a Linux system.
Do any of these seem particularly interesting to you, or would you like to explore how they work?