The Tool Shed: bash history shortcuts
The Story
You've been getting quite competent with Unix commands, but even though you're a faster typist you can't seem to keep up to the old Greybeard who has been showing you the ropes. It's as if he's using shortcuts when typing at the command line.
After watching him type out of the corner of your eye for a while, you catch on to the common ones: Using the tab key to complete command and file names, using the emacs-style line editing keys (such as control-A to move to the beginning of the line, control-E for the end, control-K to erase to the end of the line and so forth). But there's some other ones that he's using that seem less common, and they all involve using the history or creative shell expansion.
For example, when you make a simple typo you've been using the command history to fix up. For example, if you'd typed rm somefale.txt when you meant somefile.txt, you would do something like this: up-arrow, left-arrow, left-arrow, left-arrow, left-arrow, left-arrow, left-arrow, backspace, i. That's 9 keystrokes.
The old Greybeard does this: ^a^i. That's only 4 keystrokes.
Another time you see him rename a file with the mv command. Where you would have used mv somedaemon.conf somedaemon.bak, he does a (much shorter) mv somedaemon.{conf,bak}.
Or if he wants to re-run the last command mentioned the host caliban he'd apply a wildcard on his history command: !?caliban?. That's handy if you're connected to many sites - it's the host name that matters, not the command you use to connect with (such as ssh or telnet).
You've often used the command history (almost wearing out your up-arrow!), but notice that when the Greybeard wants to repeat the command for the last place he used telnet to connect to he simply does a !tel.
He uses a shortcut when performing many operations on the same file too. For example if he was to edit a text file (vi somefile.txt and then checking the spelling of it he'd do like this: ispell !$ (which repeats the last word on the previous command line). That shortcut looks handy, especially when doing the "edit, compile, view, edit ..." LaTeX dance.
The Details
These shortcuts were written with the bash shell in mind, but similar shortcuts are available in other advanced shells (such as zsh, ksh and tcsh). You really should read the man page for bash to see exactly how these shortcuts work, or at least play around with them using the echo command rather than something more dangerous like rm.
The Wrap-up
Interesting. After picking up these tips your mastery of the shell has grown. You come to understand the nuances of bash and start to wear a smug grin on your face.
And the old Greybeard notices that smug look and promptly uses his rootly powers to change your shell to csh. That'll teach you to learn only one shell :-)

