Linux: How to get an external IP address from the command line

curl checkip.amazonaws.com
curl ifconfig.me
curl icanhazip.com
curl ipecho.net/plain
curl ifconfig.co

or

dig +short myip.opendns.com @resolver1.opendns.com

or

#!/bin/bash
MYIP=$(wget -O - -q icanhazip.com);
echo $MYIP;
2017   command line   ip   linux   terminal
Popular