host

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.

host howtogeek.com
host 208.43.115.82

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.

Purpose

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

Syntax

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 192.168.1.5 or 75.126.153.206
AAAA IPv6 IP address 2607:f0d0:1002:51::4
CNAME Canonical name record (Alias) s0.cyberciti.org is an alias
for d2m4hyssawyie7.cloudfront.net
MX Email server host names smtp.cyberciti.biz or mx1.nixcraft.com
NS Name (DNS) server names ns1.cyberciti.biz or ns-243.awsdns-30.com
PTR Pointer to a canonical name.
Mostly used for implementing reverse DNS lookups
82.236.125.74.in-addr.arpa
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. Required fields are marked *

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