Network and remote access

Command host

Run a simple DNS query

Linux · Bash examples · commands run on the selected server

When to use host

Use host for concise DNS checks when you need a quick record lookup. Specify the record type for a targeted investigation and compare resolver responses without changing the server's DNS configuration.

Syntax

host [PARAMETERS] NAME [DNS_SERVER]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-t TYPE
Select a record type, for example MX.
-a
Make a verbose query; ANY response behavior depends on the server.
-W N
Set the response timeout in seconds.

Usage examples

Find out the domain address

host example.com

Common address information is requested from the default resolver.

Check MX records

host -t MX example.com

Mail-exchange records are requested explicitly.

Request via the specified DNS

host example.com 1.1.1.1

The lookup uses the named public resolver instead of the configured default.

Notes and limitations

  • host is a DNS utility and may not consult all name sources in the system NSS configuration.
  • Use dig to inspect a DNS response in detail.

Common questions and troubleshooting

Why is a name found locally but not by host?

A local hosts-file entry or application cache may supply the name without a DNS record. Check which resolution path matters to the application.

Why do two resolvers disagree?

Caches, propagation, policy and split-horizon zones can differ. Check authoritative data and TTLs before assuming one response is wrong.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man host.