The host utility

host is a utility (DNS client) for working with domain records. It is used to query DNS servers and retrieve records for the requested domain.

  • -t record — query information about specific record.
  • -t ANY or -a — query information about all records.
  • IP address — reverse DNS lookup — to obtain information about a specific IP address, simply enter the address.
  • server — to obtain information from a specific DNS server, simply enter its name or address after the domain name.
  • -v or -d — detailed output (options are equivalent).

The simplest query:

host ukraine.com.ua

Answer with explanatory comments:

ukraine.com.ua has address 185.39.224.54                      # domain A record
ukraine.com.ua has IPv6 address 2a04:8000:0:e022::54          # domain AAAA record
ukraine.com.ua mail is handled by 20 alt1.aspmx.l.google.com. # domain MX record
ukraine.com.ua mail is handled by 10 aspmx.l.google.com.

To get information about a specific record, use the -t option followed by the record type (A, AAAA, CNAME, TXT, MX, NS):

host -t a ukraine.com.ua

Answer:

ukraine.com.ua has address 185.39.224.54

To get information about all records, use the -t option and the ANY label, or simply the -a option (equivalent to -v -t ANY):

host -a ukraine.com.ua 8.8.8.8

Answer:

Trying "ukraine.com.ua"
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48991
;; flags: qr rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ukraine.com.ua.                        IN      ANY

;; ANSWER SECTION:
ukraine.com.ua.         899     IN      SOA     ns1.ukraine.com.ua. hostmaster.adm.tools. 2019102588 43200 7200 604800 60
ukraine.com.ua.         899     IN      AAAA    2a04:8000:0:e022::54
ukraine.com.ua.         899     IN      TXT     "v=spf1 include:_spf.ukraine.com.ua include:_spf.google.com -all"       
ukraine.com.ua.         899     IN      TXT     "google-site-verification=IafnKVUlyUkkXGv3cgYvmdJch6oYHIm_vZwt8nwfnGc"  
ukraine.com.ua.         899     IN      A       185.39.224.54
ukraine.com.ua.         899     IN      NS      ns1.ukraine.com.ua.
ukraine.com.ua.         899     IN      NS      ns2.ukraine.com.ua.
ukraine.com.ua.         899     IN      NS      ns3.ukraine.com.ua.
ukraine.com.ua.         899     IN      MX      10 aspmx.l.google.com.
ukraine.com.ua.         899     IN      MX      20 alt1.aspmx.l.google.com.Received 398 bytes from 8.8.8.8#53 in 85 ms

Important points:

  • The command returns information strictly for the specified domain or subdomain. If you specify a domain name, you cannot retrieve information about its subdomains, and vice versa — if you specify a subdomain, the command will return information only for that subdomain; records for the main domain will not be returned.
  • Not all DNS servers can return information about all records at once. For example, the CloudFlare server at 1.1.1.1 does not return this information, whereas the Google server at 8.8.8.8 does.

To look up a hostname by IP address (PTR record), simply enter the IP address:

host 185.39.224.54

Answer:

54.224.39.185.in-addr.arpa domain name pointer ukraine.com.ua.

To get a response from a specific DNS server, specify its name or IP address after the domain:

host ukraine.com.ua 8.8.8.8

Answer:

Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:

ukraine.com.ua has address 185.39.224.54
ukraine.com.ua has IPv6 address 2a04:8000:0:e022::54
ukraine.com.ua mail is handled by 10 aspmx.l.google.com.
ukraine.com.ua mail is handled by 20 alt1.aspmx.l.google.com.

For a detailed response, use the -v option:

host -v ukraine.com.ua

Answer:

Trying "ukraine.com.ua"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15072
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;hosting.xyz.                        IN      A

;; ANSWER SECTION:
ukraine.com.ua.         354     IN      A       185.39.224.54

Received 48 bytes from 1.1.1.1#53 in 14 ms
Trying "ukraine.com.ua"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21694
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ukraine.com.ua.                        IN      AAAA

;; ANSWER SECTION:
ukraine.com.ua.         540     IN      AAAA    2a04:8000:0:e022::54

Received 60 bytes from 1.1.1.1#53 in 19 ms
Trying "ukraine.com.ua"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25901
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ukraine.com.ua.                        IN      MX

;; ANSWER SECTION:
ukraine.com.ua.         407     IN      MX      20 alt1.aspmx.l.google.com.
ukraine.com.ua.         407     IN      MX      10 aspmx.l.google.com.Received 87 bytes from 1.1.1.1#53 in 16 ms
المحتوى