The host command performs DNS lookups. Give it a domain name and you’ll see the associated IP address. Give it an IP address and you’ll see the associated domain name.


The host is a simple and essential command line tool. It is used for the following purposes:

  1. Performing DNS name lookups.
  2. Finding the IP address of a host or vice versa.
  3. List and validate various types of DNS resource records such as as NS and MX names.
  4. Verify ISP dns server and Internet connectivity.
  5. Verify spam and blacklisting records.
  6. Verifying and troubleshooting dns server problems.


Use host command to resolve a host name into an Internet Protocol (IP) address or an IP address into a host name.


The basic syntax:
host ip-address-here
host host-name-here
host host-name-here [DNS-Server-Name-Here]
host [options] IPAddress | Hostname [DNS-Server-Name-Here]

List of DNS record types

Before you use the host command you should aware of common types of resource records of the DNS. Here are most common resource records:

Type Purpose Examples
A IPv4 IP address or
AAAA IPv6 IP address 2607:f0d0:1002:51::4
CNAME Canonical name record (Alias) is an alias
MX Email server host names or
NS Name (DNS) server names or
PTR Pointer to a canonical name.
Mostly used for implementing reverse DNS lookups
SOA Authoritative information about a DNS zone see below
TXT Text record see below

By default, host command looks for A, AAAA, and MX records only.

Host command examples

Let us see how to use host command on Linux and Unix. You need to give a hostname or an IP address as an argument to get various information about that host. Open the Terminal applications and type the following commands.

Find the IP address of a Hostname

To find the address of a host machine called wks05, run:

host wks05


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.