host(1)
Perform DNS lookups to find IP addresses or hostnames associated with a domain.
Synopsis
host [-aCdlriTwv] [-c CLASS] [-N ndots] [-t TYPE] [-W time] [-R retries] NAME [SERVER]Description
The host command is a simple DNS lookup utility that queries name servers to translate domain names to IP addresses and vice versa. It supports A, AAAA, MX, NS, SOA, SRV, TXT and other DNS record types.
If a SERVER is specified, the query is sent to that particular nameserver; otherwise the default system nameservers are used. Results show the record type, TTL, and value returned by the DNS server.
Common options
| Flag | What it does |
|---|---|
-a | query all record types (equivalent to -t ANY) |
-t TYPE | specify DNS record type (A, AAAA, MX, NS, SOA, SRV, TXT, CNAME, etc.) |
-C | perform a zone transfer and display all records (AXFR query) |
-c CLASS | specify query class (default: IN for internet) |
-v | verbose output; shows the query and full response |
-w | wait indefinitely for a response (don't timeout) |
-r | disable recursive queries; query authoritative servers only |
-i | reverse IP lookup (find hostname from IP address) |
-T | enable TCP for the query (default is UDP) |
-W time | set timeout in seconds for query response |
Examples
look up the IP address of example.com using default nameservers
host example.comdisplay all DNS records for example.com (A, AAAA, MX, NS, TXT, etc.)
host -a example.comshow mail exchanger (MX) records for example.com
host -t MX example.comdisplay TXT records, commonly used for SPF, DKIM, and DMARC
host -t TXT example.comperform reverse DNS lookup to find the hostname for IP address 192.0.2.1
host 192.0.2.1query Google's nameserver (8.8.8.8) for example.com instead of default servers
host example.com 8.8.8.8show detailed output including query details and full DNS response
host -v example.comlist the authoritative nameservers for example.com
host -t NS example.com