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:
A variation of a script I found on this site and then slimmed down to just use awk. It displays all users who have attempted to login to the box and failed using SSH. Pipe it to the sort command to see which usernames have the most failed logins.
Quick and dirty command that counts how many words can be typed just using the home row on the Dvorak Simplified Keyboard layout from a dictionary file, in this case /usr/share/dict/words.
According to the regular expression supplied, each word must contain all the keys on the Dvorak home row, and no other characters. For comparison, I've shown how many words are installed in my dictionary, how many can be typed with just the Dvorak home row and how many can be typed with just the QWERTY home row in the sample output. Nearly 10 times the amount.
If you want to see the words, remove the -c switch, and each word will be printed out.
xml with verbose commenting can be difficult to read. remove comments from xml.
converts RAW files from a Nikon DSLR to jpg for easy viewing etc.
requires ufraw package
This will view the console and assumes the screen is 80 characters wide.
Use /dev/vcs2 for the next virtual console.. etc.
Downloads at 12:00
Converts images (maybe from scans) into a PDF
Other logs can be monitored similarly, e.g.
watch "tail -15 /var/log/daemon.log"
When you fill a formular with Firefox, you see things you entered in previous formulars with same field names. This command list everything Firefox has registered. Using a "delete from", you can remove anoying Google queries, for example ;-)
This is useful for remove all packages that are part of a common suite.
This command adds the numbers 10, 12, 14 to a bunch of mp3's in the current working directory. You can then run the command replacing the inital i=10 with i=11 to add 11,13,15 in another directory then mv the files together and the first files interweave with the second group of files. I used this to weave a backlog of a podcast with other podcast so I didn't get sick of one while I was catching up. I started at 10 because printf blows up with 0 padded numbers 08 and 09 which kind of makes the printf command redundant as it was used to pad numbers 1 - 9 so they would come first and not get sorted incorrectly
This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.
Reduce the number of keystrokes it takes to open a file in vim. First of all, you just need to type "v", which is less than half the number of characters (!), and second-of-all, you only need to enter a substring of the file you want to open. For example, if you want to open the file, homework.txt, then type "v hom" to open it. Good tip is to use the lowest unique substring, otherwise you'll open multiple files in different buffers (which is sometimes desirable). Use Ctrl-^ to switch between buffers.
This example, for example, produces the output, "Fri Feb 13 15:26:30 EST 2009"
Have a grudge against someone on your network? Do a "find -writable" in their directory and see what you can vandalize! But seriously, this is really useful to check the files in your own home directory to make sure they can't inadvertently be changed by someone else's wayward script.