How to find the public IP address from command line

Here is how to find the public IP address from command line. You first need to install curl as you need to rely on an external web server to get the public IP address. On Debian, Ubuntu or Linux Mint:

$ sudo apt-get install curl


On Fedora, CentOS or RHEL:

$ sudo yum install curl


The following is a list of commands that you can run to determine the public IP address. You can define an alias using one of these commands, or use them in a shell script.

$ curl ifconfig.me
$ curl icanhazip.com
$ curl ident.me
$ curl ipecho.net/plain
$ curl whatismyip.akamai.com
$ curl tnx.nl/ip
$ curl myip.dnsomatic.com
$ curl ip.appspot.com
$ curl ip.telize.com
$ curl curlmyip.com
$ curl -s checkip.dyndns.org | sed 's/.*IP Address: \([0-9\.]*\).*/\1/g'
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

How To: Back Up MySQL Databases From The Command Line

While automated backups are important, sometimes you just want to take a quick and dirty snapshot...

How To Install MariaDB on CentOS 6

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and...

How to Display (List) All Jobs in Cron / Crontab

View Root’s Cron Jobs crontab -l  View a User’s Cron Jobs crontab -u username -l Example with...

How To: Automate Server Scripts With Cron

Servers can automatically perform tasks that you would otherwise have to perform yourself, such...

How to find sending spam emails and enable mail header in php.ini

- In Linux servers if there are a lot of emails in the queue "over 100" emails. you can check if...