DEV Community

Cover image for Find Out Your IP on Ubuntu & macOS
Jonas Schumacher
Jonas Schumacher

Posted on

Find Out Your IP on Ubuntu & macOS

So at some point you will want to know your own IP Address. And when that time comes, here is how to do it.

If you are on macOS:

ifconfig | grep inet
Enter fullscreen mode Exit fullscreen mode

This will give you a list of IPv4 and IPv6 addresses. Grab the one that says inet next to it and that should be it.

If you are on Ubuntu:

ip addr show
Enter fullscreen mode Exit fullscreen mode

Now this I just love. You could even shorten that to ip a if you wanted to, but why would you with such a beautifully descriptive command?

If ip addr show gives you too much information, hostname -I does the trick as well, only more focused.

Sources:
https://osxdaily.com/2010/11/21/find-ip-address-mac/
https://itsfoss.com/check-ip-address-ubuntu/

Top comments (0)