28 October 2011

delete preceding word in the command line with ctrl+w http://goo.gl/XhTCU

A few handy movement commands

Sometimes a mistake is noticed before the enter key is pressed. We’ve already talked about terminals that don’t translate cursor-keys properly, so how do you fix a mistake? To make matters worse, sometimes the backspace key gets mapped to ^H or even worse something like ^[[~. Now how do you fix your mistake before hitting the enter key?

Once again, bash comes through for us. Here are some of the movement keystrokes that I use most often:

^w erase word
^u erase from here to beginning of the line (I use this ALL the time.)
^a move the cursor to the beginning of the line
^e move the curor to the end of the line

There are more of course, but those are the ones you simply can't live without. For those who don't know the ^N notation means ctrl+N, don't confuse it with hats mentioned above.

from samrowe.com

No comments:

Post a Comment