What is my Public IP address?

Use one of the following commands to check your public IP address from the Linux command line.

Get the Public IP address from the Linux Command Line

0. Easy to Remember Services

Get your external IP address using the curl command:

$ curl ifconfig.me
$ curl ip.appspot.com
$ curl icanhazip.com

Get your external IP address using the wget command:

$ wget -q -O - ifconfig.me
$ wget -q -O - ip.appspot.com
$ wget -q -O - icanhazip.com

Get the External IP address using DynDNS.org

1. Using the wget command:

$ wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

2. Using the curl command:

$ curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

3. Using the lynx command:

$ lynx -dump checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//' | sed '/^$/d'


Another way

curl ipinfo.io

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What Is My Router’s IP Address (Default Gateway)

A router is a device that communicates between the Internet (or public network) and the devices...

CIDR Notation – Explained & Examples

CIDR (Classless Inter-Domain Routing) notation is a compact method for specifying IP addresses...

Disable IPv6 on Linux – Ubuntu, Debian, CentOS

To disable IPv6 on Linux it is required to modify Linux kernel parameters. IPv6 can be temporary...

169.254.0.0/16 – Disable ZEROCONF Route

You may notice that in your routing table you have a route 169.254.0.0/16. It is so called...

Finding Active Computers in Local Network from Linux

Searching for Linux command that can list all IP addresses of devices connected to the network?...