_au7da
Last Updated: April 09, 2016
·
2.401K
· jjbohn
E1a6432aa826c13daa63e0d6deb47e67

How to get your public IP address from the terminal

Came across this little command the other day. This does a simple GET request to http://ifconfig.me, which returns your IP address.

curl ifconfig.me

There are also a few other commands that can give you other information including your hostname, user agent, etc. You can get it return in json, xml or plain text. I encourage you to checkout http://ifconfig.me on the web to see them all.

There are a few services to retrieve your public facing IP address, but I think this one is the nicest/easiest to remember.

From: http://jjbohn.info/cheat-sheet/how-to-get-your-public-ip-address-from-the-terminal/

Say Thanks
Respond

3 Responses
Add your response

3084
 body onload alert 1

This has already been shared, but it's good nonetheless. :)

https://coderwall.com/p/-t2lwa

over 1 year ago ·
14418

icanhazip.com responds a lot faster here. Same script-friendly format. :)

over 1 year ago ·
14419
42560b40c451f0bf1941764b939cfa68

I usually use curl ipecho.net/plain

Thanks for sharing anyway!

over 1 year ago ·
Filed Under