In bash, how does one clear the current input?

Ctrl-U, Ctrl-K does the trick as well.

Ctrl-U deletes everything from the beginning of the line up to the cursor, Ctrl-K deletes everything from the cursor to the end of the line. (It is sometimes useful to use only one of them.)


Found a short reference at http://www.ice2o.com/bash_quick_ref.html while searching.

ctrl + e (if not at the end of the line) plus ctrl + u will do it.


  1. Press Ctrl-U to delete everything before the cursor. The deleted command will be stored into a buffer. Press Ctrl-Y to paste the deleted command.

    (Optional: Press End or Ctrl-E to jump to the end of the input first.)

  2. Alternatively, press Ctrl-C to abort what you're typing.


Try Ctrl+U. That clears the input line.

Tags:

Bash

Input