host
Overview
host is a simple DNS lookup utility. Faster to type than dig for everyday A/AAAA/MX checks; use dig when you need full message sections or uncommon record types.
Syntax
host [options] name [server]
host [options] IPCommon Options
| Option | Description |
|---|---|
-t type |
Record type (A, AAAA, MX, TXT, NS, CNAME, SOA, …) |
-a |
All records (ANY — often blocked) |
-v |
Verbose |
-W secs |
Wait |
-R n |
Retries |
-C |
SOA for zone check style queries |
Examples with Explanations
host example.com
host -t MX example.com
host -t TXT example.com
host -t AAAA example.com
host 1.1.1.1
host example.com 8.8.8.8
host -v example.comScript snippet
if host -W 2 example.com >/dev/null; then echo ok; fi