Linux commands to find IP address of a website
The Linux also provides commands to get IP address a website.
What is an IP address?
The IP address is a network technology designed to allow connected devices to communicate with other devices over the Internet. It is like labelling any device connected to a network so that it can be uniquely identified.
Each device connected to the internet will be assigned a unique IP address.
Two different versions of IP address
- IPv4
- IPv6
An IPv4 address would be like 126.457.14.512
based on decimal(0-9) values.
An IPv6 address would be like: 2001:DB8::8A2E:370:7334
based on hexadecimal(0-9 and A-F) values.
This article shows the usage of command line utilities to get IP address and other details
Find the IP address of a website using dig command
The dig
command
The dig is a network administration command-line utility for Domain Name System (DNS) lookup.
It is useful for troubleshooting network and for educational purposes. It supports Internationalized Domain Name (IDN) queries.
It is quite popular among DNS administrators to troubleshoot DNS problems due to its flexibility and ease of use.
Syntax for dig
command
dig <websiteURL>
Example of dig
command
dig facebook.com
...
;; ANSWER SECTION:
duckduckgo.com. 173 IN A 40.81.94.43
...
The ANSWER SECTION will list the IP address of a website.
Find the IP address of a website using the host command
The host
command
The host is also network command-line utility for performing Domain Name System (DNS) lookup.
It is most commonly used for converting names to IP addresses and vice versa.
Syntax for host
command
host <websiteURL>
Example of dig command
host facebook.com
...
duckduckgo.com has address 40.81.94.43
duckduckgo.com mail is handled by 0 duckduckgo-com.mail.protection.outlook.com.
...
In this article, you just saw two networking command utility that gives the desired result to retrieve website IP address in Linux terminal.
Hope you like this quick Linux tip!
Keep helping and happy 😄 coding