commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Easy way to grab the IP address of a machine for easy script use. If needed a "| grep -v 127.0.0.1" at the end will suppress localhost.
There is 1 alternative - vote for the best!
ifconfig is dead, long-live iproute2
this also uses only awk to do the grepping and removal of CIDR notation
Require the moreutils package
If you can do better, submit your command here.
You must be signed in to comment.