Advance

How to find server public IP Address in Linux terminal

How to find server public IP Address in Linux terminal

A Linux users needs to know some Linux tricks. In this article, you are going to learn how to find server public IP Address in Linux terminal.

As you know, IP address is a numerical identifier assigned permanently or temporarily to every device connected to a network that uses the Internet Protocol for communication, in computer networking. Identifying a network or hosting on a network is its function. We use two current versions of IP addresses: IPv4 and IPv6. The addresses can be either private or public.

Also, there are two ways a host can be assigned, a static or dynamic IP address, which will be chosen depending on the network configurations.

 

How to find server public IP Address in Linux terminal

Let’s walk through the 4 ways, which helps users find their server public IP address.

Recommended Article: How to find server public IP Address in Linux terminal

You may be interested in:

Set IP static on Ubuntu 20.04 LTS Server with netplan

How to add a second IP to Ubuntu

1. Using dig utility

For probing DNS name servers, you need a utility. So use the opendns.com resolver to find your public IP addresses.

dig +short myip.opendns.com @resolver1.opendns.com    120.88.41.175    

2. Using host utility

For carrying out DNS lookups, you need to use a host command. Run the below command to display your system’s public IP address in Linux terminal.

host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}'    120.88.41.175

 

Please note: On the two remaining methods of finding your IP address, we will present third party websites on the command line.

3. Using wget command line downloader

You can use the Wget, as a powerful command-line downloader that supports various protocols like HTTP, HTTPS, FTP, and many more. And also, to find your public IP address, you can use it with third-party websites.

wget -qO- http://ipecho.net/plain | xargs echo  wget -qO - icanhazip.com    120.78.58.115      

4. Using cURL command-line downloader

One of the most popular tools for uploading or downloading files from a server using any of the supported protocols (HTTP, HTTPS, FILE, FTP, FTPS, and others), is curl. So use the below command to view your public IP address.

curl ifconfig.co  curl ifconfig.me  curl icanhazip.com    120.78.58.115 

 

In case you need to read more, follow the Linux tricks.

 

Dear user, we hope you would enjoy this tutorial how to find server public IP Address in Linux terminal, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problems in it.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+18054214518

7 days a week, 24 hours a day