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.
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:
If you are in ex mode in vim i.e. you've pressed ':'. You can edit the current command by pressing <ctrl-f>
This will diff your local version of the file with the latest version in svn. I put this in a shell function like so:
svd() { vimdiff <(svn cat "$1") "$1"; }
Make sure that find does not touch anything other than regular files, and handles non-standard characters in filenames while passing to xargs.
needs no GNU tools, as far as I see it
saves one command. Needs GNU grep though :-(
The grep switches eliminate the need for awk and sed. Modifying vim with -p will show all files in separate tabs, -o in separate vim windows. Just wish it didn't hose my terminal once I exit vim!!
This will drop you into vim to edit all files that contain your grep string.
By using vim, you can also filter content on stdout, using vim's extra power, like search pattern offset!
No more awk of course, sorry.
details :
-e ex mode
-s silent
-c 'ex command' : global + start and end pattern + offset print (p)
-cq : quit
Whereas ^V is CTRL-V.
converts a dos file to unix by removing 0x13 characters
In edit mode, toggle the case of a single word under the cursor in vim.
I often use "vim -p" to open in tabs rather than buffers.
This is a simple command for jumping to the matching brace, square bracket, or parentheses. For example, it can take you from the beginning of a function to the end with one key stroke. To delete everything between the pairs of {}, [], or (), issue the command:
d%
To replace text between pairs of braces, brackets, or parentheses, issue the command:
c%
You can also use this command to find out if an opening brace has been properly closed.
Often I need to edit a bash or perl script I've written. I know it's in my path but I don't feel like typing the whole path (or I don't remember the path).
While I love gpg and truecrypt there's some times when you just want to edit a file and not worry about keys or having to deal needing extra software on hand. Thus, you can use vim's encrypted file format.
For more info on vim's encrypted files visit: http://www.vim.org/htmldoc/editing.html#encryption
So you keep getting buzzes sounding from pidgin but you can't remember which buddy pounce is causing the beep. Well, cat/edit the ~/.purple/pounces and find out!