Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking for a way to delete the currently entered commandline without wasting seconds on the "Backspace"-key.

For example I scrolled the bash history and have a long commandline 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.

The question may seem trivial but this is bothering me for a long time now... :-)

Regards

share|improve this question

2 Answers

up vote 3 down vote accepted

Pressing Ctrl+u will empty the current line.

share|improve this answer
Thanks, that did it. Ctrl-u deletes all characters before the cursor position. – vobject Sep 28 '10 at 10:38
+1: That's been driving me nuts :) – Mike Fitzpatrick Sep 28 '10 at 10:43
@vobject: If your cursor is within the line, Ctrl-u then Ctrl-k (or vice-versa) will get it all. – Dennis Williamson Sep 28 '10 at 16:55

Press Ctrl+C to cancel the command you're entering and go back to a bare prompt.

This is a common key in unix text mode applications:

  • in non-interactive programs, Ctrl+C usually stops the program altogether and goes back to a shell prompt;
  • in interactive programs that execute one command at a time (such as shells), Ctrl+C usually returns to the main command prompt.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.