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
Last activity: Dec 11, 2023, 03:19 PM