nerdexam
LPI

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.

Security and File Permissions

Question

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

Options

  • Awhoami
  • Blsgroup
  • Cwho
  • Did

How the community answered

(26 responses)
  • A
    8% (2)
  • B
    4% (1)
  • C
    12% (3)
  • D
    77% (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.

Awhoami

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

Blsgroup

'lsgroup' is not a standard command on Linux or Unix systems and does not exist by default.

Cwho

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

DidCorrect

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

#id command#group membership#user identity#whoami

Community Discussion

No community discussion yet for this question.

Full 010-150 Practice