How can I delete from cursor to start in terminal (delete, not cut)

Mithril

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.

Wayne_Yux

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I delete folders using regex from Linux terminal

How to delete (not cut) in Vim?

How can I quickly delete a line in VIM starting at the cursor position?

How can I increase the cursor speed in terminal?

How to delete directory from path in terminal?

Can I delete all migration files and start from scratch?

How can I Delete from a CloudKit container?

how can I cut a line, delete other line and then paste the first one?

How can I delete this directory?

How can I delete files in terminal fluently?

How can I delete input in the terminal?

How do I delete a file in terminal?

How can I delete data with Cursor in Android?

In Vim, how can I delete all text from the current cursor position until the next space?

How to delete a file from the GRUB terminal?

Why I can't delete selected strings with the cursor in xfc4-terminal ? But I can delete selected strings one by one

How to delete gnome web from the terminal?

How can I automatically start from the terminal in Kali Linux?

How to delete specific files from terminal

How to delete a Component from Visual studio terminal?

How can I delete from two tables

How can I delete data from IFileListEntry?

How can I cut rows into another sheet then delete + shift for the next row without a loop freezing?

how can i delete a permission from a group

VSCode OSX TERMINAL Delete Right From Cursor

How to delete in terminal from "/" to "/"?

How I can Delete Record from Firebase?

How can I move terminal cursor by word?

How can I delete a user from a section