In Terminal, how to erase typed command quickly?
Solution 1:
You can cancel current command with ⌃ CTRL+c. You can clear command to the beginning with ⌃ CTRL+u. To clear line after the cursor press ⌃ CTRL+K.
Here are some great answers on StackOverflow.
Solution 2:
You can just use cmd + . to stop and go to a new command prompt on a new line.
It will not erase what you typed. But more importantly it will not execute it.
Solution 3:
Terminal natively supports basic Emacs key mappings. As such:
Press Ctrl+a to move the cursor to the beginning of the line and then Ctrl+k to delete to the end of line.