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.