The Great Escape #
AnthonyEnglish 270000RKFN Visits (5316)
Do you use control-c a lot? What about the backspace key? I have to admit that on the command line I'm a pretty
Why is that so helpful? First of all, it turns your mistyped line into a comment. More importantly, it saves the line into your shell history, so you can recall it later.
A comment on your mistakes
You might not have thought of putting comments on the command line. Many people don't put them into their scripts. But if you turn your typing mistakes into comments, they won't get run. That's the idea of hitting control-c, but the escape-hash (or escape-pound) combination has a big advantage: it saves your mistakes for you to revisit them and fix them. (I'm sure there's a moral in that somewhere).
Recalling your mistakes
Esc # allows you to come back to a command you've half entered. If you use the Korn shell, you can use Esc k to revise your recent commands. If you prefer bash, use the up arrow. Once you've recalled the previous command (or, really, the previous comment), you can just hit Esc # to take out the comment symbol (#), edit the line if necessary and turn it into a real command.
You might like to use the great escape # when you start a command and think of another one you have to run first. I often use it when I cd to a long directory path but remember I need to check something first.
The great escape #
You may be surprised that a simple combination of key strokes can be so helpful. It allows you to recycle your unwanted commands. It's certainly easier than investing in learning to type.