How many times do you find yourself using the arrow keys to move to the beginning or end of the command line in a bash terminal? Do you use backspace to delete every single character to clear what you’ve typed? If you answered “yes” to either of these questions, continue reading.
I have been doing this a lot myself because I couldn’t remember the shortcut keys for these tasks. So, I decided to write them here for future reference. While you can easily find more thorough information on the web, here are some useful shortcuts.
| Key Sequence | Description |
|---|---|
Ctrl + U | Cut the text from the cursor to the start of the line. |
Alt + D | Cut the word after the cursor. |
Alt + Backspace | Cut the word before the cursor. |
Ctrl + A | Move the cursor to the start of the line. |
Ctrl + E | Move the cursor to the end of the line. |
Ctrl + Left Arrow | Move the cursor one word to the left. |
Ctrl + Right Arrow | Move the cursor one word to the right. |
I hope these shortcuts save you some time and your fingers from getting sore.