nerdexam
LPI

010-160 · Question #66

Which command display the list of groups to which a user belongs?

The correct answer is D. id. The 'id' command displays the current user's UID, primary GID, and all supplementary group memberships. It is the standard tool for listing group membership on Linux.

Security and File Permissions

Question

Which command display the list of groups to which a user belongs?

Options

  • Awhoami
  • Blsgroup
  • Cwho
  • Did

How the community answered

(25 responses)
  • B
    4% (1)
  • C
    8% (2)
  • D
    88% (22)

Why each option

The 'id' command displays the current user's UID, primary GID, and all supplementary group memberships. It is the standard tool for listing group membership on Linux.

Awhoami

'whoami' only prints the effective username of the current user and provides no group membership information.

Blsgroup

'lsgroup' is not a standard Linux command and does not exist on typical Linux distributions.

Cwho

'who' shows which users are currently logged into the system, not the group memberships of a specific user.

DidCorrect

The 'id' command outputs the user ID (uid), primary group ID (gid), and all supplementary groups the user belongs to in one line, for example: uid=1000(alice) gid=1000(alice) groups=1000(alice),27(sudo),1001(docker). It directly answers the question of which groups a user belongs to and is available on all POSIX-compliant systems.

Concept tested: Linux id command user and group identity

Source: https://man7.org/linux/man-pages/man1/id.1.html

Topics

#id command#user groups#user identity

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice