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:
With a lolcat favicon if you access it from your browser
echo "ls" > script.bash;
This is my script, a simple 'ls'.
gpg -c script.bash;
Here I encrypt and passord-protect my script. This creates file script.bash.gpg.
cat script.bash.gpg | gpg -d --no-mdc-warning | bash
Here I open file script.bash.gpg, decrypt it and execute it.
self explanatory see sample output
Crop several images by imagemagik's convert command. substitute , ,, with pixel value and with a different existent directory.
but you can't see the colors in that sample output :(
Although Exim will purge frozen (undeliverable) messages over time, the command "exim -Mrm #id#" where #id# is a particular message ID will purge a message immediately. Being lazy, I don't want to type the command for each frozen message, so I wrote the one-liner to do it for me.
Will unmount a mount that has already dropped but is locked by a process.
cut -f1 -d\<TAB>
Calc the rough time from Twitter. Now with leading Zeroes.
Using tape archive create a tar file in Stdout (-) and pipe that into a compound command to extract the tar file from Stdin at the destination. This similar to "Copy via tar pipe ...", but copies across file systems boundaries. I prefer to use cp -pr for copying within the same file system.
It can be used to create an index of a backup directory or to find some file.
Here's a version that uses netcat (although I'd much rather use curl!).
specific information about your intel CPUs in your system and their features
This is useful for paging through long directories, mulitple directories, etc. I put this in my ~/.bash_aliases file and alias 'lsl' to it.
The '[r]' is to avoid grep from grepping itself. (interchange 'r' by the appropriate letter)
Here is an example that I use a lot (as root or halt will not work):
while (ps -ef | grep [w]get); do sleep 10; done; sleep 60; halt
I add the 'sleep 60' command just in case something went wrong; so that I have time to cancel.
Very useful if you are going to bed while downloading something and do not want your computer running all night.
Will check if the given module is installed in the @INC. It will print the path and return 0 if found, or 1 otherwise.
Based on script from SharpyWarpy in http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/