nerdexam
LPI

102-500 · Question #114

Which of the following getent invocations lists all existing users?

The correct answer is C. getent passwd. getent passwd queries the passwd database, which is the standard Unix/Linux database containing all user account entries - each line includes username, UID, GID, home directory, and shell. This is the authoritative way to list all users because it respects NSS (Name Service…

Administrative Tasks

Question

Which of the following getent invocations lists all existing users?

Options

  • Agetent homes
  • Bgetent uids
  • Cgetent passwd
  • Dgetent users
  • Egetent logins

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    73% (19)
  • D
    15% (4)

Explanation

getent passwd queries the passwd database, which is the standard Unix/Linux database containing all user account entries - each line includes username, UID, GID, home directory, and shell. This is the authoritative way to list all users because it respects NSS (Name Service Switch), pulling from /etc/passwd and any configured sources like LDAP or NIS.

The distractors fail because getent only accepts valid NSS database names: homes, uids, users, and logins are not valid databases recognized by getent, so those invocations would return an error or empty output. The valid databases include passwd, group, hosts, services, shadow, and a handful of others - nothing resembling the made-up names in A, B, D, and E.

Memory tip: Think "passwd = people." Just as /etc/passwd has always stored user accounts (historically with passwords, now just metadata), getent passwd is the NSS-aware equivalent - same name, same data, broader sources.

Topics

#user accounts#getent command#NSS databases#system administration

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice