Damn Useful: When You Forget to type Sudo
codeulate.com
codeulate.com
i.e.
host:test user$ touch one two three four five
host:test user$ ls
five four one three two
host:test user$ cat four
host:test user$ echo !!:1
echo four
four
Also, "Esc, dot" is an awesome bash shortcut. (Press them consecutively, not concurrently). It inserts the last argument of the previous command in place. So if you're doing something to the same file, Esc, . will usually bring up the file name.i.e.
host:test user$ cat five
host:test user$ touch [Esc, .]I intentionally restrained myself to one tip. See http://codeulate.com/?p=21 for the reasoning.
However, I don't think it makes sense to post it on HN. If all the posts on the front page were little snippets, the conversation would quickly degenerate.
Also, TONS of crap gets submitted to HN. You're seeing this because it was voted to the front page. I don't think I'm affecting the quality of conversation negatively.
When working on a production box, I've trained myself to type the command without sudo, then actually take my hands off the keyboard and sit on my hands while I ponder what might go wrong with the command. Then I hit ^A sudo space return.
No, no, he's got it all wrong. The son then says "Okay, I'll do it in a minute" and proceeds to go back to playing WoW or whatever he does for fun.
^[ k I sudo
Esc (^[ = Esc) exits to command mode, k goes to the previous command, shift-i moves the cursor to the beginning of the line and sudo is well sudo.
Slightly more complex but it is reflex from all of the other programs I use.
I gave up and switched to Ubuntu.
Edit: even better resource: http://colinux.wikia.com/wiki/Main_Page