Concept Flow - whoami and id commands
Start
Run 'whoami'
Display current username
Run 'id'
Display user and group info
End
The flow shows running 'whoami' to get the username, then 'id' to get detailed user and group info.
whoami id
| Step | Command | Action | Output |
|---|---|---|---|
| 1 | whoami | Get current username | alice |
| 2 | id | Get user and group IDs | uid=1001(alice) gid=1001(alice) groups=1001(alice),27(sudo) |
| Variable | Start | After whoami | After id | Final |
|---|---|---|---|---|
| username | undefined | alice | alice | alice |
| uid | undefined | undefined | 1001 | 1001 |
| gid | undefined | undefined | 1001 | 1001 |
| groups | undefined | undefined | 1001(alice),27(sudo) | 1001(alice),27(sudo) |
whoami: shows current username id: shows user ID, group ID, and groups Use whoami for simple username Use id for detailed user info Both help identify current user context
whoami command display when run in a Linux terminal?whoamiwhoami command is designed to show the username of the current user logged into the shell.whoami.whoami = username [OK]id without arguments shows user ID, group ID, and group memberships.id shows user and group info [OK]id to see user and group IDs [OK]id -u if the current user has user ID 1001?-u option of id-u option prints only the numeric user ID (UID) of the current user.1001, not a string with 'uid=' or other text.id -u = UID number only [OK]id -u but get an error: "id: invalid option -- 'U'". What is the likely cause?-u is lowercase. Using uppercase -U instead of lowercase -u can cause errors.whoami prints the current username. Using echo $(whoami) prints it clearly.id -Gn prints all group names the user belongs to, separated by spaces.echo $(whoami) && id -Gn correctly combines username and group names. whoami -g && id -u uses invalid whoami -g. id -un && id -G uses id -un (which prints username) and id -G (which prints numeric group IDs, not names). whoami && id -G prints username and numeric group IDs, not names.Pass the test and this pattern moves unknown