Clear a Line in Bash
By: Cam Wohlfeil
Published: 2019-06-07 1025 EDT
Category: Solutions
Tags:
linux,
bash
In Windows, I'm used to being able to clear a line simply by hitting Esc
, but it's not quite as easy from Bash.
- 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.