Checking your public WAN IP address directly from the Linux command line is executed using lightweight cURL HTTP requests or DNS queries.
Public IP Terminal Commands
# 1. Query public IPv4 address via ifconfig.me
curl ifconfig.me
# 2. Query public IP and location metadata via ipinfo.io
curl https://ipinfo.io/json
# 3. Query public IP via OpenDNS server
dig +short myip.opendns.com @208.67.222.222
Comments and corrections