Linux command
host 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Lookup IP address
host [example.com]
Reverse DNS lookup
host [192.168.1.1]
Query specific DNS server
host [example.com] [8.8.8.8]
Query specific record type
host -t [MX] [example.com]
Verbose output
host -v [example.com]
Query all records
host -a [example.com]
说明
host is a simple DNS lookup utility. It converts hostnames to IP addresses and vice versa, and can query specific DNS record types. The tool provides quick DNS queries without the complexity of dig, making it useful for simple lookups and troubleshooting.
参数
- -t _type_
- Query type (A, AAAA, MX, NS, TXT, SOA, etc.).
- -a
- Equivalent to -v -t ANY; queries all record types with verbose output.
- -A
- Like -a but omits RRSIG, NSEC, and NSEC3 records.
- -C
- Check SOA record consistency across authoritative name servers.
- -v
- Verbose output (equivalent to -d).
- -l
- Perform a zone transfer (AXFR) and list NS, PTR, and A/AAAA records.
- -4
- Use IPv4 transport only.
- -6
- Use IPv6 transport only.
- -r
- Non-recursive query (clears RD bit).
- -s
- Do not try the next name server after a SERVFAIL response.
- -W _seconds_
- Query timeout in seconds (default: 5 for UDP, 10 for TCP).
- -w
- Wait forever (set query timeout to maximum).
- -R _retries_
- Number of UDP query retries.
- -T
- Use TCP instead of UDP.
- -U
- Force UDP, even for ANY queries.
- -p _port_
- Query port (default: 53).
- -N _ndots_
- Number of dots required for an absolute name lookup.
- -c _class_
- Query class (IN, HS, CH; default: IN).
- -m _flag_
- Memory debugging (record, usage, or trace).
- -V
- Print version number and exit.
FAQ
What is the host command used for?
host is a simple DNS lookup utility. It converts hostnames to IP addresses and vice versa, and can query specific DNS record types. The tool provides quick DNS queries without the complexity of dig, making it useful for simple lookups and troubleshooting.
How do I run a basic host example?
Run `host [example.com]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t _type_ do in host?
Query type (A, AAAA, MX, NS, TXT, SOA, etc.).