Is there any way to delete a line of text?

For example, if my current line/command is something really long like.

> git log --graph --all --blah..uh oh i want to cancel and clear this line <cursor is here now>

There is a shortcut to this?

>

?

Usually I will press the key, and if my current line is a brand new one on the history, that will clear it. But if I'm going through my command history via the key and start editing or using those commands, will only change the prompt to the next newest command in history, so it doesn't work here unless I press multiple times.

Best Answer


You can use Ctrl + U to clear up to the beginning.

You can use Ctrl + W to delete just a word.

You can also use Ctrl + C to cancel.

If you want to keep the history, you can use Alt + Shift + # to make it a comment.


Bash Emacs Editing Mode Cheat Sheet