How to Find Your IP Address on Linux from the Terminal
Local IP with 'ip a' and public IP with curl, and why ifconfig is no longer the recommended option.
Local IP (inside your network)
ip a
Look for the "inet" line under your active interface (usually
wlan0 for wifi or eth0/enp...
for cable).
ip is the modern command. If you still see guides
with ifconfig, keep in mind it's marked as deprecated on
many recent distributions — ip a is its direct
replacement and does the same thing.
Public IP (facing the internet)
curl ifconfig.me
Returns directly the address your entire network identifies itself with to the internet — different from your local IP.
Frequently asked questions
Why should I use 'ip' instead of 'ifconfig'?
ifconfig is considered deprecated on many modern distributions, though it still works on some. 'ip a' is the equivalent modern command, actively maintained.
Are my local IP and my public IP the same?
No, they're different — the local one identifies your machine within your own network; the public one is what your network shows facing the internet.