Curl Plain Text Format output:
Curl icanhazip.com
Curl ifconfig.me
Curl curlmyip.com
Curl ip.appspot.com Curl IPINFO.IO/IP Curl Ipecho.net/plain
Curl www.trackip.net/i
Curl JSON format output:
Curl Ipinfo.io/jsoncurl Ifconfig.me/all.jsoncurl Www.trackip.net/ip?json (a bit ugly)
Curl XML Format output:
Curl Ifconfig.me/all.xml
Curl Get all IP details (excavators)
Curl Ifconfig.me/all
Use Dydns (useful when you use the Dydns service)
Curl-s ' http://checkip.dyndns.org ' | Sed ' s/.*current IP address: \ ([0-9\.] *\). */\1/g '
curl-s http://checkip.dyndns.org/| grep-o ' [[:d Igit:].] \+"
Use Wget instead of Curl
wget Http://ipecho.net/plain-O-Q; echo
wget Http://observebox.com/ip-O-Q; Echo
Using the host and Dig commands
If so, you can also use the host and dig commands directly.
Host-t a dartsclink.com | Sed ' S/.*has address//'
dig +short myip.opendns.com @resolver1. opendns.com
Bash Script Example:
#!/bin/bash
public_ip= ' wget http://ipecho.net/plain-O-Q; Echo '
echo $PUBLIC _ip
Source: https://my.oschina.net/epstar/blog/513186