Command for resolving ip address for host entry in /etc/hosts? I'm looking for a command that will let me resolve a host name in /etc/hosts to its corresponding IP address.
nslookup ignores entries in /etc/hosts file.
ping will find entries in /etc/hosts but is difficult/slow to capture the output.
On macOS you can use dscacheutil, the Directory Service Cache Utility, for this purpose.
dscacheutil -q host -a name localhost                                                                     

The output looks like:
name: localhost
ipv6_address: ::1

name: localhost
ip_address: 127.0.0.1

(On Linux, the equivalent is getent.)