commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Get just the IP address for a given hostname. For best results, make this a function in your shell rc file so that it can be used for things like traceroute:
Titus:~$ traceroute `getip foo.com`
traceroute to 188.8.131.52 (184.108.40.206), 64 hops max, 52 byte packets
GeoIP Needs to be installed. Can be done from some distro's or via MaxMind.com for free. There even is a free city database availabble. If the GeoLiteCity is downloaded and installed it will also find more information
geoiplookup -f /var/lib/GeoIP/GeoLiteCity.dat commandlinefu.com
GeoIP City Edition, Rev 1: US, NJ, Absecon, 08201, 39.420898, -74.497704, 504, 609
Grabs the ip2location site and removes everything but the span tag containing the country value. Place it inside your .bashrc or .bash_aliases file.
Useful for creating MAC addresses for virtual machines on a subnet. 00:16:3e is a standard Xen OID, change as needed.
for those that don't have curl
Very effective, use only DNS protocol. The @ part is optional if you already set opendns servers as default ns servers.
Short command, easy to remember
Wgets "whatismyip" from checkip.dyndns.org and filters out the actual IP-adress. Usefull when you quickly need to find the outward facting IP-address of your current location.
nmap for windows and other platforms is available on developer's site: http://nmap.org/download.html
nmap is robust tool with many options and has various output modes - is the best (imho) tool out there..
from nmap 5.21 man page:
-oN/-oX/-oS/-oG : Output scan in normal, XML, s|
documents all active ips on a subnet and saves to txt file.
Curl is not installed by default on many common distros anymore. wget always is :)
wget -qO- ifconfig.me/ip
Here's a version that uses netcat (although I'd much rather use curl!).
If curl isn't available, use lynx.
With a lolcat favicon if you access it from your browser
Works on any machine with nmap installed. Previous version does not work on machines without "seq".
Also works on subnets of any size.
Extracts ip addressess from file using sed. Uses a tag(ip) to grep the IP lines after extracting. Must be a way to just output regex matched on sed.
This is useful when you got a reserved IP address like 192.168.0.100 and want to find out what IP address is used to access the Internet. You have to know a server with 'efingerd -n' configured, like www.linuxbanks.cn as above.
Other method to find out this information are for example access www.tell-my-ip.com and grep the output. The finger method have the advantage that it is easy to deploy a service like www.tell-my-ip.com, as you only need to get efingerd installed.
Request all information about my IP address in json format
Request all information about my IP address in xml format