How To Find IP Address From Domain Name In Linux/Unix?

How To Find IP Address From Domain Name In Linux/Unix?


This post was last updated on August 1st, 2020 at 03:35 pm

Before we start running a command to find the IP addresses from the domain name. First, we will discuss briefly IP address and domain names. An IP address is a unique identifier that is assigned to each device connected to a computer network and uses Internet protocol for communication.

A computer uses this address to send data to a specific computer. IPv4 and IPv6 are two versions of IP addresses available nowadays. Every computer with an IP address has an IPv4 address and many of them are starting to use IPv6.

Ahead in this article, we will discuss to find the IP address from a domain name in a Unix terminal.

Different versions of IP address

Currently, there are two versions of IP addresses that are in use –


IPv4 defines an IP address as a 32-bit number which is consists of four fields separated by a dot. IP addresses are written and displayed in a human-readable form. So each field of the address is a decimal representation of the 8-bit binary number. Example of IPv4 address –


In recent decades the internet grows massively. because of this growth and depletion of IPv4 addresses, a new version of IP (i.e. IPv6) was standardized in 1998. IPv6 address has 8 groups of hexadecimal numbers each separated by a colon. It uses 128 bits for a single IPv6 address. Example of IPv6 address – 2606:2800:220:1:248:1893:25c8:1946

What is a domain name?

The Internet is a big network of computers that are interconnected to each other. Each computer on the internet is identified by a unique address called IP address. An IP is a series of decimal or hexadecimal numbers separated by a dot or colon. It typically looks something like which is comparatively difficult to remember. Now imagine what if you had to visit your favorite website with IP. A domain name is used to solve this problem. For example –,, etc.

Find IP using the host command

In Unix host is a simple utility to perform DNS lookups. It is normally used to convert the domain name to IP address and vice versa. When no argument is given it prints a short summary of arguments and options that can be used with it. To find the IP using the host command follow the steps given below –

1. Open your terminal by pressing ctrl+alt+t

2. And then type the following command and press enter-

host domain_name

For example-


As you can see above it display both IPv4 and IPv6 addresses. Now if you want to find the host whose IP is, then use the host command and pass the IP as the argument –


To display the short summary of options and argument, use the host command as given below –


Or if you want to know more about host command see its manual page –

man host

Find IP using nslookup

Nslookup or name server lookup is a command-line tool useful in getting information from the domain name server. It is available for various operating systems. Nslookup is used to troubleshoot DNS related problems. To obtain IP which is mapped to a domain name, use the following command in your terminal –

nslookup domain_name

For example –


You can also perform a reverse DNS lookup by providing IP address as an argument to the nslookup command.

nslookup IP_address

For example-



To know more about nslookup command see its manual page with –

man nslookup
Previous How To Set/Change Root Password In Ubuntu?
Next How To List All The Users In A Linux Or Unix System?

About author

You might also like

Linux Topics 0 Comments

Grub Vs Lilo

A system requires different programs for accomplishing different tasks. The boot loader is the first program that runs when a computer starts. It is responsible for loading and transferring control

How To 0 Comments

How To Add Bash Auto Completion In FreeBSD?

This post was last updated on August 1st, 2020 at 09:06 amBash is a modern and one of the most widely used shells in Unix like operating systems. It is

How To 0 Comments

How To Install And Use sudo In FreeBSD?

This post was last updated on August 1st, 2020 at 10:28 amThe sudo (superuser do) is a program for Unix like operating systems. It allows a user to run a


No Comments Yet!

You can be first to comment this post!

Leave a Reply