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:
find . -type f -name '*.wav' -print0 |xargs -0 -P 3 -n 1 flac -V8
will encode all .wav files into FLAC in parallel.
Explanation of xargs flags:
-P [max-procs]: Max number of invocations to run at once. Set to 0 to run all at once [potentially dangerous re: excessive RAM usage].
-n [max-args]: Max number of arguments from the list to send to each invocation.
-0: Stdin is a null-terminated list.
I use xargs to build parallel-processing frameworks into my scripts like the one here: http://pastebin.com/1GvcifYa
If you used to do `vlc /tmp/Flash*`, but no longer can't, this is for you.
For instance, if people have signed your key, this will fetch the signers' keys.
If your version of curl does not support the --compressed option, use
curl -s http://funnyjunk.com | gunzip
curl -s --compressed http://funnyjunk.com
This command can be used to rename all the files with extension .xls( in this case) to .ods files. It can be used for other files with certain extension.
Use case: folder with flac files with tree structure ../artist/album/number-title.flac
1) convert flac->mp3 in the same folder: http://www.commandlinefu.com/commands/view/6341/convert-all-.flac-from-a-folder-subtree-in-192kb-mp3
2) search for mp3 files and recreate tree structure to another path: http://www.commandlinefu.com/commands/view/8853/copy-selected-folder-found-recursively-under-src-retaining-the-structure
3) move all mp3 files to that new folder: this command
This command lists all the directories in SEARCHPATH by size, displaying their size in a human readable format.
There's nothing particularly novel about this combination of find, grep, and wc, I'm just putting it here in case I want it again.
Calc the rough time from Twitter. Now with leading Zeroes.
This combines @zurvollenstunde's hourly tweets and the "n minutes ago" from Twitter search.
to be executed from root. this works well on most commercial unix systems, have not tried on linux systems.
I have some problems with gnome panel which does not load completely leaving me without the actual GUI. This commands helps to kill the gnome-panel process then it should be relaunch automatically.
This example command fetches 'example.com' webpage and then fetches+saves all PDF files listed (linked to) on that webpage.
[*Note: of course there are no PDFs on example.com. This is just an example]
Original submitter's command spawns a "grep" process for every file found. Mine spawns one grep with a long list of all matching files to search in. Learn xargs, everyone! It's a very powerful and always available tool.
Undo accidental file add to mercurial.
This command undo file adds to all recent adds
urldecode files in current directrory
An advanced possibility to count the lines of code like in #8394
it recursively searches your project's directories and sum the lines of every source [.c or .h]. Then it gives you the total.