Use one command to query passwd, hosts and other system databases through NSS. 09.06.2026 | reading time: 2 min Want a reliable way to ask the system what it knows about users, groups or hosts regardless of whether the data comes from local files, LDAP, or DNS? The `getent` command queries the Name Service Switch so you see entries exactly as the system resolves them. Hands-on example Try these commands to see `getent` in action and compare results from different name services: ``` $ getent passwd root root:x:0:0:root:/root:/bin/bash $ getent passwd nobody nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin $ getent hosts 8.8.8.8 8.8.8.8 dns.google ``` Why this matters Instead of opening `/etc/passwd` or running DNS tools one by one, `getent` shows the view the system actually uses because it goes through `nsswitch.conf`; that means accounts from LDAP, SSSD or NIS appear the same way as local accounts and you avoid mistakes caused by inspecting only local files. Common databases and usage Use the form `getent database [key ...]` for frequent lookups: `passwd`, `group`, `hosts`, `services`, `protocols`, `networks`, `aliases` and more; for example `getent passwd alice` or `getent group sudo` will return the resolved entry or nothing if the key is unknown. Practical troubleshooting tips If `getent` returns nothing while you expect an account, check `nsswitch.conf` and whether SSSD/sssd or an LDAP client is running, confirm network reachability to directory servers, and use `ldapsearch` or DNS tools to isolate whether the problem is resolution or permissions. Related components to inspect Remember that `getent` only reflects what NSS provides; when deeper investigation is needed inspect `nsswitch.conf`, SSSD logs or the LDAP server directly, and validate DNS with `dig` or `host` to separate name resolution issues from NSS configuration. Next steps Practice `getent` on a system joined to an LDAP server or Active Directory to see remote accounts appear; mastering this simple query helps in daily troubleshooting and is a useful skill for certification candidates preparing for CompTIA Linux+ or LPIC-1 at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities network troubleshooting