Sample Header Ad - 728x90

Host lookup that respects /etc/hosts

25 votes
6 answers
16733 views
Utilities like host and dig let you see the IP address corresponding to the host name. There is also the getent utility that can be used to query /etc/hosts or other NSS databases. I am looking for a convenient standard utility (which is available in Debian, say) which resolves a host name regardless of where it is defined. It should be more or less equivalent to ping "$HOST" | head -1 | perl -lne '/\((.*?)\)/ && print $1'
Asked by Roman Cheplyaka (1214 rep)
Apr 5, 2013, 08:14 PM
Last activity: Dec 11, 2023, 03:19 PM