Linux host Command: Look Up DNS Names and Addresses
host is a simple DNS tool that looks up domain names to IP addresses and IP addresses to reverse names. It is convenient for quick checks and allows you to specify the record type for queries.
What is the host command?
By default, it uses the DNS server set on the system, but you can specify a different server as the last argument. If you enter an IP address, it attempts a PTR-based reverse lookup. Compared to dig, the output is concise, but full DNS information may be needed for analyzing complex responses.
Basic syntax
host [options] name|IP [DNS server]
Installed implementations and options may vary depending on the distribution. Check the current system description with man host.
Examples
Domain address lookup
Quickly check basic results such as A and AAAA.
host example.com
Mail record lookup
Check mail receiving servers using MX records.
host -t MX example.com
Reverse Lookup
Check if there is a PTR name registered for the IP.
host 192.0.2.1
Simple DNS Lookup Results
host is a simple DNS lookup tool to find the address from a name or to check the reverse name of an address.
host example.com
Example of output format (actual addresses may vary):
example.com has address 192.0.2.10
There may be multiple IPv4 and IPv6 addresses for the same name, so the output can have multiple lines. host -t MX domain looks up mail exchange records. If there are connection issues, check separately whether the DNS results are returned and whether the target port is actually open.
Main Options and Format
| Options/Format | Description |
|---|---|
-t format |
Specify the DNS record type to query. |
-a |
Query with detailed information. |
-v |
Display detailed contents of the query and response. |
-4 / -6 |
Limit the IP version used for sending the query. |
Last server argument |
Query the specified DNS server instead of the default server. |
Precautions when using
The fact that there are no reverse lookup results means that there is no PTR record or it cannot be accessed, not that the IP is unused. DNS responses and actual connectivity are separate matters. If the record is not visible, check the queried server, cache, and record format.
Frequently Asked Questions
Are host and hostname the same command?
No. host queries DNS information, while hostname displays or sets the current system's host name.
Official Documentation
The exact behavior of options and implementation differences can be found in the official documentation related to host.









