- do host lookups using system libraries
utility does hostname and IP lookups. It returns the hostname, any
aliases, the IPv4 or IPv6 address, and, optionally, the time taken
for each hostname to lookup. It uses standard Unix libraries
instead of using direct DNS resolver lookups. This is useful in
troubleshooting, because it will do lookups as your system sees
For example, if your
name-service configuration uses
hosts files dns
then it will do a lookup against /etc/hosts first.
The following options are available:
Use IPv6 instead of default IPv4.
Show the elapsed time of the lookup in fractional seconds.
Do a reverse lookup; find a hostname from an IP address.
If no options are used, then it defaults to looking up the IP
address for the hostname given on the command-line.
The options can be repeated for each hostname to lookup by
placing before hostname.
If a colon ":" is seen in hostname, it is assumed to be an
IPv6 address and a reverse lookup is attempted.
utility exits 0 on success of last (or only) lookup.
It returns >0 if an error occurs on the final lookup.
If the IP address is invalid or improperly formated, the return
value is 2. If the host is unknown (or not found), then the return
value is 3. If there is a problem with network address to display
format conversion, the error value is 4.
- gethost -x 127.0.0.1 -t -6 localhost
will give the hostname for 127.0.0.1 and then give the IPv6 address
for "localhost" and show the elapsed time for just that second lookup.
- gethost 3ffe:8050:201:1860:290:27ff:feab:19a7
will return the hostname for that IPv6 address.
- RETURN VALUES
- SEE ALSO
This document was created by man2html
using the manual pages.
Time: 08:15:02 GMT, July 06, 2002