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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
biggest->small directories, then biggest->smallest files
It's useful mostly for your custom scripts, which running on specific host and tired on ssh'ing every time when you need one simple command (i use it for update remote apt repository, when new package have to be downloaded from another host).
Don't forget to set up authorization by keys, for maximum comfort.
If you need to fix a randomly failing test (race condition), you need to run it until you get that hard-to-reproduce failure.
Run this within a steady screen session.
You can get the approximate time when the remote server went down or other abnormal behavior.
This will, for an application that has already been removed but had its configuration left behind, purge that configuration from the system. To test it out first, you can remove the last -y, and it will show you what it will purge without actually doing it. I mean it never hurts to check first, "just in case." ;)
Are the two strings anagrams of one another?
sed splits up the strings into one character per line
the result is sorted
cmp compares the results
Note: This is not pretty. I just wanted to see if I could do it in bash.
Note: It uses fewer characters than the perl version :-)
Found this one little more for me. This one removes the perl dependency (from command 2535).
Source for command : http://www.earthinfo.org/linux-disk-usage-sorted-by-size-and-human-readable/
CHANGELOG
Version 1.1
removedir () { echo "You are about to delete the current directory $PWD Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=$(echo "$PWD" | sed 's/ /\\ /g'); foo=$(basename "$blah"); rm -Rf ../$foo/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
BUG FIX:
Folders with spaces
Version 1.0
removedir () { echo "You are about to delete the current directory $PWD Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=`basename $PWD`; rm -Rf ../$blah/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
BUG FIX:
Hidden directories (.dotdirectory)
Version 0.9
rmdir () { echo "You are about to delete the current directory $PWD. Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=`basename $PWD`; rm -Rf ../$blah/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
Removes current directory with recursive and force flags plus basic human check. When prompted type yes
1. [user@host ~]$ ls
foo bar
2. [user@host ~]$ cd foo
3. [user@host foo]$ removedir
4. yes
5. rm -Rf foo/
6. [user@host ~]$
7. [user@host ~]$ ls
bar