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.
![Create a CSS Flipping Animation]()
CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...
![Creating Scrolling Parallax Effects with CSS]()
Introduction
For quite a long time now websites with the so called "parallax" effect have been really popular.
In case you have not heard of this effect, it basically includes different layers of images that are moving in different directions or with different speed. This leads to a...
![Create a Spinning, Zooming Effect with CSS3]()
In case you weren't aware, CSS animations are awesome. They're smooth, less taxing than JavaScript, and are the future of node animation within browsers. Dojo's mobile solution, dojox.mobile, uses CSS animations instead of JavaScript to lighten the application's JavaScript footprint. One of my favorite effects...
![CSS Gradients]()
With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements. CSS gradients are another step in that direction. Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...
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).
ip route get 8.8.8.8 | awk 'NR==1 {print $NF}'Some time ago I started using an alternative which only uses DNS queries:
Google > “My IP” = Winner!
$ curl ipinfo.io { "ip": "174.47.27.98", "hostname": "174-47-27-98.static.twtelecom.net", "city": "Orange", "region": "California", "country": "US", "loc": "33.7878,-117.8531", "org": "AS4323 tw telecom holdings, inc.", "postal": "92666" } $ curl ipinfo.io/ip 69.170.45.10 $ curl ipinfo.io/org AS4323 tw telecom holdings, inc.See http://ipinfo.io/developers for more details
I just search Google for “what is my ip” like a n00b.
I prefer:
alias publicip='curl ipecho.net/plain ; echo' alias localip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"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.
curl -s "https://www.google.ie/search?client=firefox-b&q=myip&oq=myip&gs_l" | grep "Client IP address" | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"