Get IP Address from Command Line
Over the past few years I've needed to look up my IP address a dozen times. What's funny is that I don't recall why I needed it, I just did. So what's the easiest way to get my IP address from the command line?
To get your internal IP, you can do the following:
ipconfig getifaddr en0
I go through ipecho.net to get it:
curl ipecho.net/plain ; echo
# >> 71.87.32.78
Why go through an external resource? Your local address and your external address aren't the same, so using the external resource is the best way to tell what the world is seeing your IP address as.
You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...
If you follow me on Twitter, you know that I've been working on a super top secret mobile application using Appcelerator Titanium. The experience has been great: using JavaScript to create easy to write, easy to test, native mobile apps has been fun. My...
GitHub seems to change a lot but not really change at all, if that makes any sense; the updates come often but are always fairly small. I spotted one of the most recent updates on the pull request page. Links to long branch...
Remember the Web 1.0 days where you had to customize your site in every way possible? You abused the scrollbars in Internet Explorer, of course, but the most popular external service I can remember was CometCursor. CometCursor let you create and use loads of custom cursors for...
I prefer the slightly simpler/easier to remember
ipinfo.io can give you even more information and is easier to use via tunneling as it works without a host header.
Windows users can use
ipconfig
(notice the ‘p’).Your internal IP also depends on interface you’re using, in your case (en0) it was ethernet, but it also can be WiFi (en1).
Some time ago I started using an alternative which only uses DNS queries:
Google > “My IP” = Winner!
See http://ipinfo.io/developers for more details
I just search Google for “what is my ip” like a n00b.
I prefer:
hahaha, i just think to google it :D, but thanks dude, sometimes need to apply to my terminal command
It is ugly. But the Google lovers will enjoy.
Prerequisite: curl, and grep.