Which command can be used to test the entire name resolution order as defined in nsswitch.conf?
Tests resolution via nsswitch.
Why this answer
The `getent hosts` command queries the system's Name Service Switch (NSS) configured sources in the exact order defined in `/etc/nsswitch.conf`. It uses the `gethostbyname()` or `getaddrinfo()` library calls, which respect the `hosts:` line in nsswitch.conf (e.g., `files dns myhostname`), testing resolution through each source sequentially until a result is found or all sources are exhausted.
Exam trap
The trap here is that candidates often choose `dig` or `host` because they are familiar DNS tools, but they fail to realize that these commands bypass the NSS configuration and only test DNS, not the full resolution order including local files or other sources like `myhostname`.
How to eliminate wrong answers
Option A is wrong because `host` is a DNS lookup tool that bypasses the NSS configuration and queries DNS directly via the resolver library, not testing files like `/etc/hosts` or other NSS sources. Option C is wrong because `nslookup` is a deprecated DNS diagnostic tool that queries DNS servers directly, ignoring the NSS order entirely. Option D is wrong because `dig` is a flexible DNS lookup utility that performs direct DNS queries and does not consult `/etc/nsswitch.conf` or local name resolution sources like `/etc/hosts`.