Juicy lil' bytes

How to Erase Segments of Text Relative to the Cursor Position on Your Bash Command Line

Further hone your command line chops with these shortcuts that will erase segments of text before or after your cursor position.

Delete All Text After the Cursor Position

This command deletes all text from the cursor position to the end of the line:

1
CTRL-k

Delete All Text Before the Cursor Position

This command deletes all text from the cursor position to the beginning of the line:

1
CTRL-u

If you use it with your cursor at the end of the command, this shortcut deletes the entire line.