There are many answers pointing out that I can cut (kill) text in the terminal with ctrl+u like this one of Stack Overflow

I often feel it is inconvenient to use ctrl+u. Imagine this scenario:

  1. I type a long command A longlonglonglonglonglonglong
  2. Suddenly I realise I need do another thing first, so I press ctrl+u to cut and (save) the current command
  3. I type command B wrongwrongwrongwrongwrongwrong
  4. Suddenly I realise I don't need command B, what I need is C,
  5. So I need to delete the current command, but I don't want ctrl+u, because that would overwrite command A with B.
  6. Have to crazily press backspace to delete B.

I need ctrl+u, but also need another command to only delete, not cut.


If you don't need to paste command B anywhere later, you can do this:

While on point 3 in your list, you can type CTRL+C. This will abort the command you are currently typing and you get a new clean prompt:

$ foofooofoofoo^C

If you do need command B later, you can make use of the "middle-button-paste". To do this, you can select the text with the mouse and later paste it by clicking the mouse wheel or both mouse buttons simultaneously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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