I am looking for a way to delete the currently entered command line without wasting seconds on the Backspace key.
For example I scrolled the bash history and have a long command line that would execute when I pressed Enter:
~$ aptitude search openssl | grep dev
But now I decide that I do not want to execute this command. Can I get an empty prompt fast without deleting the whole line with Backspace? On the Windows cmd you can just press Escape and it is gone. This behavior would be what I want.
Best Answer
Pressing Ctrl+U will empty the current line.
It's the default kill character on most terminals and it erases the current line (from the cursor to its beginning). The stty command can be used to get or set its value.
Be the way,
werase
stands for word erase, so Ctrl+W erases the word on the left of the cursor.