host

From RaySoft

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.[1]

Documentation

Syntax

host [PARAMETER ...] NAME [SERVER]

Parameters

-4
This option specifies that only IPv4 should be used for query transport. See also the -6 option.
-6
This option specifies that only IPv6 should be used for query transport. See also the -4 option.
-a
The -a (all) option is equivalent to setting the -v option and asking host to make a query of type ANY.
-C
This option indicates that named should check consistency, meaning that host queries the SOA records for zone name from all the listed authoritative name servers for that zone. The list of name servers is defined by the NS records that are found for the zone.
-s
This option tells named not to send the query to the next nameserver if any server responds with a SERVFAIL response, which is the reverse of normal stub resolver behavior.
-t TYPE
This option specifies the query type. The TYPE argument can be any recognized query type: CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
-T, -U
This option specifies TCP or UDP. By default, host uses UDP when making queries; the -T option makes it use a TCP connection when querying the name server.

Examples

Get the IP address of a domain
host 'raysoft.ch'

Output:

raysoft.ch has address 217.26.53.37
raysoft.ch has IPv6 address 2a00:d70:0:b:2002:0:d91a:3525
raysoft.ch mail is handled by 10 mx1.mail.hostpoint.ch.
raysoft.ch mail is handled by 10 mx2.mail.hostpoint.ch.
Get the DNS servers (NS records) of a domain
host -t 'NS' 'raysoft.ch'

Output:

raysoft.ch name server ns.hostpoint.ch.
raysoft.ch name server ns2.hostpoint.ch.

References

  1. man 1 'host'