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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
Alternately for those without getent or only want to work on local users it's even easier:
cut -d: -f1 /etc/passwd|xargs -n1 passwd -e
Note that not all implementations of passwd support -e. On RH it would be passwd -x0 (?) and on Solaris it would be passwd -f.
In some case, you need to use remote gui on servers or simple machines and it's boring to see "cannot open display on ..." if you forgot to export your display. Juste add this line in .bashrc on remote machine. Dont forget to allow remote client on your local X server :
It will change the reserve_lock attribute to all AIX EMC disk attached.
Backspace and Return/Enter equivalents
find files recursively from the current directory, and list the extensions of files uniquely
This exports all lines of input file as environment variables, assuming each line is like these:
This command takes all CR2 files in the current directory and convert them into JPG
This command will open the AVD Manager in Mac OS X.
This will check all .HTML file contents for the word "Hacked" and dump it to hacklog.txt. This is great for located all those files affected by nasty Joomla exploits. Change the .HTML to any other extension you wish to check, and of course the word "HACKED" for other searches.
Today's date on a yearly calendar...
Empties all files in /var/log over 5000k. Useful if /var goes crazy or if you just haven't cleaned up in a while.
For example: check the APT security keys to make sure the Google digital signature was imported correctly
If you want all the URLs from all the sessions, you can use :
perl -lne 'print for /url":"\K[^"]+/g' ~/.mozilla/firefox/*/sessionstore.js
Thanks to tybalt89 ( idea of the "for" statement ).
For perl purists, there's JSON and File::Slurp modules, buts that's not installed by default.
184.108.40.206 and 220.127.116.11 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.
Among other things, this allows the sorting of comment descriptions and command lines retrieved as text from CommandLineFu.com.
Another way to create temp files in your scripts, if tempfile fails, it will create a hidden local file in the current directory, don't forget to delete $FILE
This will get all links from a given URL, remove any duplicates, and output the result.
Show external IP and geolocation information.
Primary feature is the use of tee to echo IP _and_ send to geoiplookup command...Use IP as input for as many commands as you want with more >( [command] )
Requires MaxMind DB and geoiplookup tool.
Sample output has IP obfuscated on first line, lines 2-4 from having MaxMind Country && MaxMind City DBs installed
If you need to hop on a wifi fast, perhaps you're fixing a system and it's read-only this command pipes the output of wpa_passphrase used to generate a .conf file and instead reads it from the standard input stream.
The -i switch for interface may not be wlan0, as udev will change it. A quick "ifconfig" or "dmesg | grep wlan0" will show you the wireless interface name.
adjusts the 'Master' channel's volume up by 1dB.
Can use command 'amixer' to see other channels :
Simple mixer control 'Master',0
Simple mixer control 'Capture',0