How To Find My Public IP Address From Command Line On a Linux

https://‮ww‬w.lautturi.com
How To Find My Public IP Address From Command Line On a Linux

To find your public IP address from the command line on a Linux system, you can use one of the following methods:

  1. Use the curl command to retrieve your IP address from a website that displays it. For example:
curl ifconfig.co

This will retrieve your public IP address from the website ifconfig.co and display it on the command line.

  1. Use the dig command to retrieve your IP address from the domain name system (DNS). For example:
dig +short myip.opendns.com @resolver1.opendns.com

This will retrieve your public IP address from the DNS server resolver1.opendns.com and display it on the command line.

  1. Use the wget command to retrieve your IP address from a website that displays it. For example:
wget -qO - icanhazip.com

This will retrieve your public IP address from the website icanhazip.com and display it on the command line.

Keep in mind that these methods may not work on all systems, and the results may vary depending on your network configuration and internet connection.

Created Time:2017-10-16 14:38:43  Author:lautturi