# host — Simple DNS Lookup Utility

> Practical guide to host — resolve hostnames to IP addresses, query DNS records by type, and run reverse lookups from the command line.

Source: https://www.jpkc.com/db/en/cheatsheets/networking/host/

<!-- PROSE:intro -->
`host` is a lightweight DNS lookup tool from the BIND package: you resolve hostnames to IPv4 or IPv6 addresses in seconds, and reverse lookups work just as easily. Compared to `dig`, the output is shorter and immediately readable – ideal for quick checks on the command line. If you want to inspect A, MX, or TXT records without wading through lengthy response blocks, `host` is the tool to reach for.
<!-- PROSE:intro:end -->

## Basic Lookups

`host DOMAIN` — Look up the A (IPv4), AAAA (IPv6), and MX records for a domain.

```bash
host example.com
```

`host IP` — Reverse DNS lookup — find the hostname for an IP address.

```bash
host 8.8.8.8
```

`host DOMAIN SERVER` — Query a specific DNS server.

```bash
host example.com 8.8.8.8
```

## Record Type Queries

`host -t TYPE DOMAIN` — Query a specific record type.

```bash
host -t MX example.com
```

`host -t A DOMAIN` — Query IPv4 address records only.

```bash
host -t A example.com
```

`host -t AAAA DOMAIN` — Query IPv6 address records only.

```bash
host -t AAAA example.com
```

`host -t MX DOMAIN` — Query mail exchange records.

```bash
host -t MX example.com
```

`host -t NS DOMAIN` — Query nameserver records.

```bash
host -t NS example.com
```

`host -t TXT DOMAIN` — Query text records (SPF, DKIM, DMARC, verification).

```bash
host -t TXT example.com
```

`host -t SOA DOMAIN` — Query Start of Authority record.

```bash
host -t SOA example.com
```

`host -t CNAME DOMAIN` — Query canonical name (alias) records.

```bash
host -t CNAME www.example.com
```

`host -t SRV _SERVICE._PROTO.DOMAIN` — Query service records.

```bash
host -t SRV _sip._tcp.example.com
```

`host -t CAA DOMAIN` — Query Certificate Authority Authorization records.

```bash
host -t CAA example.com
```

`host -a DOMAIN` — Query all record types (equivalent to ANY). Verbose output.

```bash
host -a example.com
```

## Output Options

`host -v DOMAIN` — Verbose output — show full DNS response including headers.

```bash
host -v example.com
```

`host -4 DOMAIN` — Use IPv4 transport only.

```bash
host -4 example.com
```

`host -6 DOMAIN` — Use IPv6 transport only.

```bash
host -6 example.com
```

`host -W SECONDS DOMAIN` — Set the query timeout in seconds.

```bash
host -W 10 example.com
```

`host -R RETRIES DOMAIN` — Set the number of retries on failure.

```bash
host -R 3 example.com
```

`host -T DOMAIN` — Use TCP instead of UDP for the query.

```bash
host -T example.com
```

## Zone Transfer

`host -l DOMAIN SERVER` — List all records in a zone (AXFR zone transfer). Requires authorization.

```bash
host -l example.com ns1.example.com
```

## Common Patterns

`host DOMAIN | grep 'has address'` — Extract only IPv4 addresses from the output.

```bash
host google.com | grep 'has address'
```

`host DOMAIN | grep 'mail'` — Extract only mail server records.

```bash
host google.com | grep 'mail'
```

`host -t TXT _dmarc.DOMAIN` — Check the DMARC policy for a domain.

```bash
host -t TXT _dmarc.example.com
```

`for d in DOMAIN1 DOMAIN2 DOMAIN3; do echo "$d:"; host $d; echo; done` — Look up multiple domains in a loop.

```bash
for d in google.com github.com example.com; do echo "$d:"; host $d; echo; done
```

`host -t NS DOMAIN | awk '{print $4}'` — Extract just the nameserver hostnames.

```bash
host -t NS example.com | awk '{print $4}'
```

<!-- PROSE:outro -->
## Conclusion

For a quick DNS check, `host` is the natural first choice: output is concise, the invocation is short, and reverse lookups work without extra flags. When you need DNSSEC details, specific response sections, or batch lookups from a file, switch to `dig` – the two tools complement each other perfectly.

## Further Reading

- [host(1) – manual page](https://linux.die.net/man/1/host) – every option at a glance
- [BIND – Wikipedia](https://en.wikipedia.org/wiki/BIND_(software)) – background on the DNS software suite that includes host
- [Domain Name System – Wikipedia](https://en.wikipedia.org/wiki/Domain_Name_System) – DNS fundamentals
<!-- PROSE:outro:end -->

## Related Commands

- [dig](https://www.jpkc.com/db/en/cheatsheets/networking/dig/) – full-featured DNS queries with complete response output
- [nslookup](https://www.jpkc.com/db/en/cheatsheets/networking/nslookup/) – interactive DNS lookup, available on Windows and Linux
- [ping](https://www.jpkc.com/db/en/cheatsheets/networking/ping/) – check host reachability on the network

