Find your IP address from the command line
Two different things people mean when they say "my IP address": the local one on your network, and the public one the rest of the internet sees.
Local IP address
ipconfig getifaddr en0
This gives you the IP address of your Wi-Fi connection. If you are on Ethernet, use en1 instead (or check ifconfig to find the right interface).
Public IP address
curl ifconfig.me
This calls an external service that tells you the IP address your router presents to the internet.
Quick reference
| Command | What it returns |
|---|---|
ipconfig getifaddr en0 | Local IP (Wi-Fi) |
ipconfig getifaddr en1 | Local IP (Ethernet) |
curl ifconfig.me | Public IP |
Enjoyed this post?
Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.
Tags
Category:
Tags:
Year: