How do I delete my commands quickly?

Use Ctrl+U to cut text from cursor position to the beginning of the command line. Later, if you want, use Ctrl+Y to paste the cut text.

If you just want to discard the current command line and get a new clean prompt hit Ctrl+C.

For more reference please check the Ubuntu documentation for Using The Terminal


Ctrl + U should help you.

Below are the rest of the options available. Grabbed from here

UNIX understands several control-key commands, commands you enter by holding down the control key (ctrl) while striking a second key

CTRL + S - freezes the screen and stops any display on the screen from continuing (equivalent to a no-scroll key) (sometimes takes a moment to work)

CTRL + Q - un-freezes the screen and lets screen display continue

CTRL + C - interrupts a running program

CTRL + \ - same as CTRL - C but stronger (used when terminal doesn't respond)

CTRL + Z - suspends a running program (use the fg command to continue the program, see s$

CTRL + H - deletes last character typed

CTRL + W - deletes last word typed

CTRL + U - deletes last line typed

CTRL + R - searches text from history

CTRL + D - ends text input for many UNIX programs, including mail and write.

Note:

When we delete using CTRL + W or CTRL + U, we are also performing a (edit) "cut" (yank in) operation (delete and store in buffer/clipboard). To paste (yank out) the string in buffer/clipboard, use CTRL + Y.


I'm usually using Alt+Backspace. If you are using bash, this will let you delete untill the previous special character (/, ;, , etc.). If you are using zsh, it will remove the slashes and semicolons as well. It is a lot faster than just hitting Backspace.

In bash, this is different from Ctrl+w in the sense that Ctrl+w deletes the previous word wheres Alt+Backspace deletes until the previous special character is found. In zsh, both key combinations do the same thing