Find Your IP from the Command Line
The commands below show your public IP address — the one the internet sees — directly from a terminal or command prompt.
Linux / macOS
curl — simplest one-liner
curl https://api.ipify.org
Returns just your IP address on a single line.
# JSON output
curl "https://api.ipify.org?format=json"
dig — via DNS
dig +short myip.opendns.com @resolver1.opendns.com
Uses OpenDNS to resolve your public IP. Fast, no HTTP required.
Show network interfaces (local IPs)
# Linux
ip addr show
# macOS
ifconfig | grep "inet "
These are your private local-network IPs, not your public internet IP.
Windows
ipconfig — show all adapters
ipconfig /all
Lists every network adapter with its IP address, DNS servers, and MAC address.
nslookup — via DNS
nslookup myip.opendns.com resolver1.opendns.com
PowerShell
Get your public IP
(Invoke-WebRequest -Uri "https://api.ipify.org").Content
# Shorter alias
(irm "https://api.ipify.org")
List all local IPs
Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "IPv4"}