CLI Commands to Determine Public IP
Check a public IP address with PowerShell, curl, or DNS queries.
On this page
Determine Public IP #
These commands are broken into two parts, Linux and Windows CLIs.
Windows #
You can use this for Powershell
Invoke-RestMethod https://api.ipify.org
Linux/MacOS #
You can use CURL
curl https://api.ipify.org && echo
DNS #
There is also a DNS based method available
nslookup myip.opendns.com resolver1.opendns.com
dig +short myip.opendns.com @resolver1.opendns.com