Original address: http://my.oschina.net/epstar/blog/513186
Curl Plain Text Format output:
ifconfig . Mecurl curlmyip.comcurl ip.appspot.comcurl ipinfo.io/ipcurl ipecho.net/Plaincurl Www.trackip.net/I
Curl JSON format output:
Curl ipinfo.io/ifconfig. me/all.jsoncurl www.trackip.net/ip?json (a bit ugly)
Curl XML Format output:
ifconfig. Me/all.xml
Curl gets all IP details (excavator)
1 ifconfig. Me/all
Use Dydns (useful when you use the Dydns service)
' http://checkip.dyndns.org ' sed ' s/.*current IP Address: \ ([0-9\.] *\). */\1/g'-S http://checkip.dyndns.org/| grep-o "[[:d Igit:]. \+"
Use Wget instead of Curl
wget http://ipecho.net/plain-o-Q; Echowget 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.
sed ' S/.*has address// ' + short myip.opendns.com @resolver1. opendns.com
Bash Script Example:
#!/bin/bashpublic_ip= 'wget http://ipecho.net/plain-o-Q; Echo 'echo $ Public_ip
Nmap
Several ways to query the IP of the outside network under Linux