getent
A command that looks up entries in the system databases, such as users and groups, the way programs do.
In more detail
getent follows the name service configuration, so it shows local accounts and those from a directory service alike. It is the reliable way to check that an account or group exists.
Example
getent group devs prints devs:x:3000:mira,chen.Related terms
- /etc/passwd — The world-readable file that lists local accounts, one per line: name, UID, GID, description, home directory and login shell, separated by colons.
- UID and GID — The numbers Linux uses to identify a user (UID) and a group (GID); root is UID 0.
Taught in
- A Server Nobody Can Find: Addresses, Routes And Names On Both Families — CompTIA Linux+ (XK0-006) Exam Prep
- Starters, Leavers And A Service Account: Accounts On Two Families — CompTIA Linux+ (XK0-006) Exam Prep
- One Word Locked Out Every Directory User: PAM, SSSD, LDAP And Kerberos — CompTIA Linux+ (XK0-006) Exam Prep
- Three Audit Findings And A Phone: Password Policy, Lockouts And MFA — CompTIA Linux+ (XK0-006) Exam Prep
- The Tracker Is Down, For Some People: Link, Address, Route, Name And Port — CompTIA Linux+ (XK0-006) Exam Prep