host
Linux · Network · reference only
What it does
Makes simple DNS queries: it resolves a name to its IP address, or an IP to its name, and queries other record types.
Syntax
host [opciones] nombre [servidor]
Options and parameters
-t tipoRecord type: A, AAAA, MX, NS, TXT, CNAME...
-aRequests all available information, equivalent to -v -t ANY.
-vVerbose output, in the format of the DNS response.
-W segundosWait time for the response.
-4Uses only IPv4 to talk to the DNS server.
-6Uses only IPv6 to talk to the DNS server.
Usage examples
host example.comShows the IP addresses of example.com.
host -t mx example.comShows the domain's mail servers.
host 8.8.8.8Does a reverse lookup: gets the name of the address.
host example.com 1.1.1.1Queries using the 1.1.1.1 DNS server instead of the configured one.
Notes and common mistakes
- It is part of the bind9-host package, which may not be installed on minimal systems.
- For more advanced queries, dig is used.