Inspect app01's UID, primary GID, and supplementary groups in one command.
Which command is appropriate?
id USER displays the selected user's UID, primary GID, and group memberships.
Detailed explanation
getent passwd app01Incorrect. passwd data does not list all supplementary memberships.
Incorrect. passwd data does not list all supplementary memberships.
getent group app01Incorrect. It finds a group with that name, not all groups for the user.
Incorrect. It finds a group with that name, not all groups for the user.
who app01Incorrect. who lists current login sessions.
Incorrect. who lists current login sessions.
id app01Correct. id app01 displays the requested identity information.
Correct. id app01 displays the requested identity information.
Try it yourself
An example you can run in a temporary verification environment.
id $(id -un)Expected result
uid=、gid=、groups=を含む現在ユーザーの情報Key points
- id shows identity
- Primary and supplementary groups
- Accepts a username
Notes
- Environment: GNU coreutils id / 現在ユーザーの読み取りのみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.