How to Quickly Delete Commands in Command Line

command lineshortcut-keys

I use terminal for almost all tasks. Let's say I have entered a huge command like this:

sudo a-huge-command

What is the easiest way to delete the whole command with a single shortcut, rather than keep on hitting backspace key?

I'm a Ubuntu newbie looking to use Ubuntu in a professional way.

Best Answer

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