(This post is part of a series. To read more tips and to learn about the philosophy behind these posts, check out the parent post.)
You know you've done this way too many times:
ben@lispclub ~ $ apt-get install blahblahblah
E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
You forgot to type sudo first.
So what do you do? Hit up arrow, swing back to the beginning of the line, type sudo--ARGGH...THE WASTED SECONDS!
Do this instead: sudo !!
In bash, !! means "repeat the last command I entered." Bash substitutes your apt-get command after the sudo, and you finally get to install blahblahblah 0.0.13. Note that this isn't specific to sudo. If you do an ls, and then wish you'd grepped the results for foo, type !! | grep foo.
How to remember it:
Imagine an angry father yelling for his son. "Sudo!!" Sudo runs down from his room, sees the command he was supposed to be in front of, and executes it immediately.