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:
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
Taking file with ip ranges, each on it's own line like:
command returns deaggregated ip ranges using ipcalc deaggregate feature like that:
Useful for configuring nginx geo module
You send a unicast ICMP packet to each host. Many firewalls will drop that ICMP. However, in order to send the ICMP, you'll have first done an ARP request and the remote machine is unlikely to ignore that, so the computer will be in your ARP table.
should be very consistent cause it's google :-)