Command library / host
host
Simple DNS lookups
The simplest DNS tool: give it a name and it prints the addresses and mail servers behind it; give it an IP address and it does the reverse lookup. Where dig shows the whole DNS response for debugging, host prints just the answer, in plain sentences.
Practice hostUsage
host [-t TYPE] name [server]
Options and flags
namethe domain name or IP address to look up
serveroptional: the DNS server to ask instead of the default
-tTYPEthe record type to ask for, e.g. MX, TXT, NS or AAAA
-aall records, with the full verbose response
Examples
host example.orgThe addresses (and mail servers) behind a name.
host -t MX example.netOnly the mail servers for a domain.
host 9.9.9.9Reverse lookup: which name an IP address maps back to.
Common mistakes
host -t example.net MX host -t MX example.net
-t takes the record type right after it; here it would ask for a record type called example.net.