What's the best way to confirm that your /etc/hosts file is mapping a hostname to the correct IP address?
Using a tool like
dig queries an external DNS directly, bypassing the hosts file.
I tried this out and it seems to work as expected:
echo "18.104.22.168 facebook.com" >> /etc/hosts
Then I ran:
$ getent ahosts facebook.com 22.214.171.124 STREAM facebook.com 126.96.36.199 DGRAM 188.8.131.52 RA
I hope this helps you!
gethostip which accepts either hostname or IP and also has options suitable to print out exactly what you need.
$ gethostip -d facebook 184.108.40.206