Return IP Address

perl -e '$_=`ifconfig eth0`;/\d+.\d+.\d+.\d+ /; print $&,"\n";'
If you are interested in interfaces other than eth0 you will need to change eth0 to your interface name. You could use this mammoth to nab the ip4 addresses of all your interfaces perl -e '@_=`ifconfig -a`; sort(@_); foreach(@_) { /(inet addr\:)(\d+.\d+.\d+.\d+ )/; $_=$2; @uniq=grep($_ ne $prev && (($prev) = $_), @_);} print join "\n",@uniq,"\n"; ' it seems silly to have all this code when the following will work fine ifconfig -a | grep "inet " | awk -F":" ' { print $2 } ' | cut -d " " -f1
Sample Output

2009-12-05 14:24:48

3 Alternatives + Submit Alt

What Others Think

This: ifconfig -a | grep "inet " | awk -F":" ' { print $2 } ' | cut -d " " -f1 does not work on OS X...
drewk · 632 weeks and 4 days ago
So far there's only one here that works on MacOS X (and Linux): ifconfig | awk '/inet /{sub(/^[^:]+:/,"",$2); print $2}'
putnamhill · 632 weeks and 3 days ago
An IP address is a numeric identifier assigned to a computer or device on a network using the Internet Protocol for communication with other computers and devices. As cv folks reviews An IP address provides only limited information about the identity of the user since it does not indicate anything about who owns an Internet connection.
Xavier23232 · 8 weeks and 5 days ago
I think this is because of a few reasons: mobile games can be played anywhere, so people tend to play them when what is the best essay writing service bored and don't have the time or access to a desktop or console for another game.
Avery1828 · 3 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? 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.

Share Your Commands

Stay in the loop…

Follow the Tweets.

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.


Subscribe to the feeds.

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: