Command 1. Using wget
# wget http://ipecho.net/plain -O - -q ; echo
Command 2: Using curl
# curl ipecho.net/plain; echo
Command 3: Using curl
# curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
Command 4: Using curl
# curl icanhazip.com
Command 5: Using curl
# curl ifconfig.me
Get Public IP in Shell Script
#!/bin/bash PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo` echo $PUBLIC_IP
0 commenti