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:
The "vorbiscomment" utility lets you update information such as artist names and song and album tags in an Ogg Vorbis file. You can use this command to fix any mistakes that were made when ripping an album.
Yet another ps grep function, but this one includes the column headings.
The $[...] block in bash and zsh will let you do math.
This is the same as using $((...)), which also works in ksh. Of course, this is a simple, dumb wrapper and doesn't allow floating-point.
MIME::Base64 is a part of Perl5 distribution. You can also use decode_base64 for oposite result.
Upgraded Debian/Ubuntu/etc. systems may have a number of "orphaned" packages which are just taking up space, which can be found with the "deborphan" command. While you could just do "dpkg --purge $(deborphan)", the act of purging orphans will often create more orphans. This command will get them all in one shot.
Use gstreamer to capture v4l2:///dev/video0 and show ascii art video in display.
Enter your ssh public key in the remote end for future key-based authentication. Just type your password one last time. The next time you should be able to login with the public key. If you don't have a key, generate one with ssh-keygen.
Requires Bourne-compatible shell in the remote end.
Loads your CPU, run a instance for each CPU/CORE.
self explanatory see sample output
This command will generate white noise through your speakers (assuming you have sound enabled). It's good for staying focused, privacy, coping with tinnitus, etc. I use it to test that the sound works.
While copying a large file that may take up a good chunk of your hard drive, start the copy and run this command concurrently. It will print out the disk information every second. It's pretty handy when you have a large copy with nothing to monitor the progress.
This will convert filenames from uppercase to lowercase. I find this useful after downloading images from my digital camera. This works for English, but other languages may need something slightly more complex like this:
for i in *; do mv "$i" "$(echo $i|tr [:upper:] [:lower:])"; done
Also, the quote marks aren't necessary if your filenames don't contain spaces.
I have this on a daily cronjob to backup the commandlinefu.com database from NearlyFreeSpeech.net (awesome hosts by the way) to my local drive. Note that (on my Ubuntu system at least) you need to escape the % signs on the crontab.
My variant on this common function. Some highlights:
Allows you to override the default ps args of "aux"
Uses bracket trick to omit the grep process itself without having to use a second grep
Always prints the correct header row of ps output
Limitations: Ugly ps error output if you forget to quote your multi word grep argument
It is a pain grep-ing/sed-ing/awk-ing plain old df. POSIX it!