getent - get entries from Name Service Switch libraries
getent database [key ...]
Options you will use
hosts- resolve like an application: /etc/nsswitch.conf order
ahosts / ahostsv4- every address getaddrinfo() returns
passwd, group, services- the other databases
Examples
$ getent hosts api.labwhat the app will connect to
$ getent ahostsv4 example.comIPv4 only
Gotchas
- getent is the closest thing to "ask exactly like my program does". When it disagrees with dig, getent is right about the application.
- Exit code 2 = not found.
Taught in
Try getent in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.