Get public IP from bash

In case anyone finds this useful, sometimes I need to get my public IP from bash or scripts and I use api.myip.com, only because it's easy to remember.

But more and more often lately, some IPs are blocked there and get http errors, so I bought a cheap domain and I woke up a $3/year @natvps_uk from idling, and..

wget -4 -qO- myip.cam
or for ipv6
wget -6 -qO- myip.cam

(or curl -4L myip.cam if curl is your thing)

«1

Comments

Sign In or Register to comment.