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:
This command, when run from the directory containing "filename", will remove the file and any hard or symbolic links to the file.
Substitute that 724349691704 with an UPC of a CD you have at hand, and (hopefully) this oneliner should return the $Artist - $Title, querying discogs.com.
Yes, I know, all that head/tail/grep crap can be improved with a single sed command, feel free to send "patches" :D
Enjoy!
Remove all arquives except the list.
Can't have space between the commas.
Bash method to remove all files but "abc".
It would be 'rm *~abc' in Zsh.
created and tested on:
ProductName: Mac OS X
ProductVersion: 10.6.5
BuildVersion: 10H574
Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.
-depth argument will cause find to do a "depth first" tree search, this will eliminate the "No such file or directory" error messages
With the plus instead of semicolon, find builds the (eg.) rm command like xargs does - invokes as few extra processes as possible.
Go to tmp :
cd /tmp; mkdir retmp; cd retmp
Create 10 files :
for i in {1..10}; do touch test$i; done
Remove all files except test10 :
rm !(test10)
expands through shell and not find
but may hits the limit of max argument size for rm
(thus: for f in **/*.htm;do rm $f;done
but then I prefer the find command ;)
This command will remove only files, not directories: if you wish to remove both directories and files, just remove '-type f' from command above
Mac OSX creates resource forks (http://en.wikipedia.org/wiki/Resource_fork) for every file, which are extremely annoying when transferring projects over to an Ubuntu server for instance
a simple command in order to make iptables rules permanent, run @ sudo!
I think this is less resource consuming than the previous examples
alternative for "echo rm *.txt". Just doubletab the command you are willing to use and it will show you the affected files.