}

How to check what is my public IP Address on linux using the command line

Created:

Introduction

In this brief tutorial we are going to example how to get your public IP address with simple command. First we gave a simple and easy to remeber example, the second one we recommend to save it as an alias.

Using curl or wget

The web page icanhazip.com returns your IP address when you do a GET request to it. Here you have two examples, one using curl and another one using wget.

curl icanhazip.com
wget -q -O - icanhazip.com

Alternative using DynDNS

Using curl and DynDNS:

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

Using wget and DYNDNS:

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