010-150 · Question #70
Which command displays the list of groups to which a user belongs?
The correct answer is D. id. The id command prints a user's UID, primary GID, and all supplementary group memberships. It is the standard way to inspect group associations for a user.
Question
Which command displays the list of groups to which a user belongs?
Options
- Awhoami
- Blsgroup
- Cwho
- Did
How the community answered
(26 responses)- A8% (2)
- B4% (1)
- C12% (3)
- D77% (20)
Why each option
The id command prints a user's UID, primary GID, and all supplementary group memberships. It is the standard way to inspect group associations for a user.
'whoami' only prints the effective username of the current user and provides no group information.
'lsgroup' is not a standard command on Linux or Unix systems and does not exist by default.
'who' shows which users are currently logged into the system, not group memberships.
The id command outputs the current user's UID and username, primary GID and group name, and the full list of supplementary groups the user belongs to, making it the correct tool for auditing group membership. Running 'id username' also works for any specified user.
Concept tested: Displaying user and group identity with id
Source: https://www.man7.org/linux/man-pages/man1/id.1.html
Topics
Community Discussion
No community discussion yet for this question.