A few ways of looking up hostnames on Linux:
$ host yahoo.com yahoo.com has address 126.96.36.199 yahoo.com has address 188.8.131.52 yahoo.com has address 184.108.40.206 yahoo.com has IPv6 address 2001:4998:44:204::a7 yahoo.com has IPv6 address 2001:4998:c:a06::2:4008 yahoo.com has IPv6 address 2001:4998:58:c02::a9 yahoo.com mail is handled by 1 mta6.am0.yahoodns.net. yahoo.com mail is handled by 1 mta5.am0.yahoodns.net. yahoo.com mail is handled by 1 mta7.am0.yahoodns.net. $ getent hosts yahoo.com 2001:4998:58:c02::a9 yahoo.com 2001:4998:44:204::a7 yahoo.com 2001:4998:c:a06::2:4008 yahoo.com $ nslookup yahoo.com Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: yahoo.com Address: 220.127.116.11 Name: yahoo.com Address: 18.104.22.168 Name: yahoo.com Address: 22.214.171.124
getent is the way to go,
because it respects your
/etc/hosts file, but the above also reminds us that we could use
gethosstip from the
See also this good explanation at serverfault.