Methods to detect public IP address in bash

curl ipinfo.io/ip

Or

wget -q -O - ipinfo.io/ip

Or

lynx -source ipinfo.io/ip

get public ip address

You can find other ip reporting websites instead of ipinfo.io as well. To name a few:

  • http://ip4only.me/api/
  • http://ip6only.me/api/
  • https://ipgrab.io/ ➡ (got from incogma’s answer)
  • https://icanhazip.com/ ➡ (got from MCurbelo’s answer)
  • https://api.ipify.org/ ➡ (got from teuber789’s answer)

Also, what is my ip shows more information about that ip.

Leave a Comment