Skip to main content

host command

Detailed Explanation

host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options.

Basic Syntax

host [options] {name} [server]

Common Flags/Options

OptionDescription
-t <type>Specify the query type (e.g., A, AAAA, MX, NS, TXT).
-a"All" - equivalent to -v -t ANY.
-vVerbose output.
-4Use only IPv4 query transport.
-6Use only IPv6 query transport.

Real-world Examples

Find the IP address of a domain:

host google.com

Find the domain names associated with an IP address (reverse lookup):

host 8.8.8.8

Query for specific records (e.g., MX records):

host -t MX google.com

Query using a specific DNS server:

host example.com 1.1.1.1