$linuxjunkies
>

host(1)

Perform DNS lookups to find IP addresses or hostnames associated with a domain.

UbuntuDebianFedoraArch

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

FlagWhat it does
-aquery all record types (equivalent to -t ANY)
-t TYPEspecify DNS record type (A, AAAA, MX, NS, SOA, SRV, TXT, CNAME, etc.)
-Cperform a zone transfer and display all records (AXFR query)
-c CLASSspecify query class (default: IN for internet)
-vverbose output; shows the query and full response
-wwait indefinitely for a response (don't timeout)
-rdisable recursive queries; query authoritative servers only
-ireverse IP lookup (find hostname from IP address)
-Tenable TCP for the query (default is UDP)
-W timeset timeout in seconds for query response

Examples

look up the IP address of example.com using default nameservers

host example.com

display all DNS records for example.com (A, AAAA, MX, NS, TXT, etc.)

host -a example.com

show mail exchanger (MX) records for example.com

host -t MX example.com

display TXT records, commonly used for SPF, DKIM, and DMARC

host -t TXT example.com

perform reverse DNS lookup to find the hostname for IP address 192.0.2.1

host 192.0.2.1

query Google's nameserver (8.8.8.8) for example.com instead of default servers

host example.com 8.8.8.8

show detailed output including query details and full DNS response

host -v example.com

list the authoritative nameservers for example.com

host -t NS example.com

Related commands