Short command, easy to remember
Very effective, use only DNS protocol. The @ part is optional if you already set opendns servers as default ns servers.
Relies on ifconfig.me functioning. It's about as easy as it gets, and memorable to old geeks too. Show Sample Output
alternative to
curl ifconfig.me
for those that don't have curl
Show Sample Output
Clean output, if used in scripts:
GET checkip.dyndns.org|grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
or
GET icanhazip.com
Show Sample Output
It's easier then the listed command, I'm thinking. but doesn't matter much--its closer to personal preference really. Show Sample Output
Instead of hard-coding in a check to scrape info from ifconfig based on a specific interface, do it in a more portable way. This works really well if you switch between wired, wireless, bluetooth or even VPN connections. You can get your current IP in a script (since it'll be something like tun0 instead of eth0 or wlan1). This uses a well known public ip address 8.8.8.8, but it doesn't actually connect to it, it just shows you the route it would take. Show Sample Output
This relies on a public API from http://longurl.org. So, this has the weakness that if the service disappears, the function will break. However, it has the advantage that the shortened URL service will not be tracking your IP address and other metrics, but instead will track longurl.org. Thus, you can remain anonymous from the shortened URL services (although not anonymous from longurl.org). It does no sanity checking that you have provided an argument. If you do not provide one, "message" is displayed to STDOUT. Show Sample Output
This is like ping -a, but it does the opposite. It alerts you if the network is down, not up. Note that the beep will be from the speaker on the server, not from your terminal. Once a second, this script checks if the Internet is accessible and beeps if it is not. I define the Net as being "UP", if I can ping Google's public DNS server (8.8.8.8), but of course you could pick a different static IP address. I redirect the beep to /dev/console so that I can run this in the background from /etc/rc.local. Of course, doing that requires that the script is run by a UID or GID that has write permissions to /dev/console (usually only root). Question: I am not sure if the -W1 flag works under BSD. I have only tested this under GNU/Linux using ping from iputils. If anybody knows how portable -W is, please post a comment.
Plain Text Ip Output, independent of Layout change. Show Sample Output
Returns your external IP address to the command line using only wget Show Sample Output
8.8.8.8 and 8.8.4.4 are two Google public DNS. As their address is really simple, it's easy to use this command to test if Internet is reachable. Beware of large corporate networks however, that may use this address on router's loopbacks interfaces.
Asks Google what your current IP address is. Bonus: Remove "@ns1.google.com" and you will instead get the IP address of your DNS server.
Grabs your external public IP. Show Sample Output
Check your IP address using www.whatismyip.org from the command line
curl is much faster then the GET, and has less dependencies.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: