host

Linux · Network · reference only

What it does

Makes simple DNS queries: it resolves a name to its IP address, or an IP to its name, and queries other record types.

Syntax

host [opciones] nombre [servidor]

Options and parameters

  • -t tipo

    Record type: A, AAAA, MX, NS, TXT, CNAME...

  • -a

    Requests all available information, equivalent to -v -t ANY.

  • -v

    Verbose output, in the format of the DNS response.

  • -W segundos

    Wait time for the response.

  • -4

    Uses only IPv4 to talk to the DNS server.

  • -6

    Uses only IPv6 to talk to the DNS server.

Usage examples

  • host example.com

    Shows the IP addresses of example.com.

  • host -t mx example.com

    Shows the domain's mail servers.

  • host 8.8.8.8

    Does a reverse lookup: gets the name of the address.

  • host example.com 1.1.1.1

    Queries using the 1.1.1.1 DNS server instead of the configured one.

Notes and common mistakes

  • It is part of the bind9-host package, which may not be installed on minimal systems.
  • For more advanced queries, dig is used.

Related commands