host
Lookup DNS records for a hostname
TLDR
Lookup A, AAAA, and MX records of a domain
Lookup a field (CNAME, TXT, ...) of a domain
Reverse lookup an IP
Specify an alternate DNS server to query
SYNOPSIS
host [-4|-6] [-aCdlLnrvwWx] [-c class] [-N ndots] [-R number] [-t type] [-T] [-W time] [name] [server]
PARAMETERS
-4
Forces IPv4 query transport only
-6
Forces IPv6 query transport only
-a
Dumps all records (equivalent to -v -t ANY)
-c class
Specifies query class (default IN)
-C
Displays SOA records for a zone
-d level
Sets debug level (0-1 typically)
-l
Attempts zone transfer (AXFR)
-L size
Sets EDNS0 buffer size
-N ndots
Changes ndots value for absolute queries
-n
Disables /etc/hosts lookup
-r
Non-recursive queries
-R number
Sets number of retries (default 5)
-s
Strict mode: no UDP truncation handling
-t type
Specifies RR type (A, MX, NS, TXT, ANY, etc.)
-T
Uses TCP for queries instead of UDP
-v
Enables verbose output
-w
Waits forever for response
-W time
Sets timeout in seconds (default 5)
-x
Performs reverse (PTR) lookup
DESCRIPTION
The host command is a lightweight, command-line DNS resolution tool used to query DNS servers for information about domain names, IP addresses, mail exchangers, name servers, and other resource records (RRs). It is ideal for quick DNS troubleshooting, verifying configurations, or scripting network diagnostics. By default, host performs recursive lookups for A and AAAA records, displaying results in a human-readable format with canonical names, aliases (CNAME), and IP addresses.
Key features include specifying record types (-t), querying custom servers, verbose output (-v or -a for all records), TCP mode (-T) for large responses, and options for recursion control (-r), retries (-R), and timeouts (-W). It supports IPv4/IPv6 selection and classes beyond IN (Internet). Unlike dig, output is concise without raw wire format, making it user-friendly for casual use. Part of BIND utilities, it relies on system resolvers unless overridden and warns on NXDOMAIN or SERVFAIL errors.
CAVEATS
UDP default may truncate large responses; use -T. Zone transfers (-l) often blocked. Deprecated IPv6 reverse (-i) ignores ip6.arpa. Relies on resolver config; use full server for accuracy.
EXAMPLES
host example.com
Shows A/AAAA records.
host -t MX -v example.com
Verbose MX lookup.
host 8.8.8.8 ns1.example.com
Reverse PTR via specific server.
OUTPUT FORMAT
Results show hostname has address/IP, aliases via CNAME, auth servers, with TTL omitted. Errors: NXDOMAIN, SERVFAIL noted.
HISTORY
Developed by Paul Vixie for BIND 4.x in the 1990s as a simple nslookup alternative. Maintained by ISC in BIND 9+, with enhancements for IPv6, EDNS0, and modern DNSSEC. Widely distributed via bind-utils package since early Linux.
SEE ALSO
dig(1), nslookup(1), dnsdomainname(1), named-checkzone(8)


