Ultimate Bash Keyboard Shortcuts
This guide provides you with an ultimate list of bash keyboard shortcuts that can help you use your shell more efficiently. If you cannot use a mouse or pointing device at all, see Keyboard navigation for more information on navigating user interfaces with only the keyboard.
Bash Keyboard Shortcuts
These bash keyboard shortcuts navigation is useful for where the mouse doesn’t have meaning. For keyboard shortcuts that are useful to all users, see Linux Command-Line.
ALT key shortcuts
- ALT+A – Jump to the beginning of a line.
- ALT+B – Move one character before the cursor.
- ALT+C – Suspends the running command/process.
- ALT+D – Closes the empty Terminal.
- ALT+F – Move forward one character.
- ALT+T – Swaps the last two words.
- ALT+U – Capitalize all characters in a word after the cursor.
- ALT+L – Uncaptalize all characters in a word after the cursor.
- ALT+R – Undo any changes to a command that you have brought from the history if you’ve edited it.
- ALT+. – Use the last word of the previous command.
CTRL key shortcuts
- CTRL+A – Quickly move to the beginning of the line.
- CTRL+B – To move backward one character.
- CTRL+C – Stop the currently running command
- CTRL+D – Delete one character backward.
- CTRL+E – Move to the end of the line.
- CTRL+F – Move forward one character.
- CTRL+G – Leave the history searching mode without running the command.
- CTRL+H – Delete the characters before the cursor, same as BACKSPACE.
- CTRL+J – Same as ENTER/RETURN key.
- CTRL+K – Delete all characters after the cursor.
- CTRL+L – Clears the screen and redisplay the line.
- CTRL+M – Same as CTRL+J or RETURN.
- CTRL+N – Display next line in the command history. Or using the DOWN arrow.
- CTRL+O – Run the command that you found using reverse search i.e CTRL+R.
- CTRL+P – Displays the previous line in the command history. Or using the UP arrow.
- CTRL+R – Searches the history backward (Reverse search).
- CTRL+S – Searches the history forward.
- CTRL+T – Swaps the last two characters.
- CTRL+U – Delete all characters before the cursor.
- CTRL+V – Makes the next character typed verbatim.
- CTRL+W – Delete the words before the cursor.
- CTRL+X – Lists the possible filename completions of the current word.
- CTRL+XX – Jump to start point of the line and back to the current cursor position.
- CTRL+Y – Retrieves the last item that you deleted or cut. Opposite of CTRL+W.
- CTRL+Z – Stops the current command.
- CTRL+[ – Equivalent to ESC key.
Miscellaneous Bash Keyboard Shortcuts
- !! – Repeats the last command.
- ESC+t – Swaps the last two words.
- Tab – Auto-complete files and folder names
Source: Linux keyboard shortcuts.
Did you know the reverse command og ALT+.?
Like down arrow is reverse of up arrow in history, the reverse command of ALT+.
Thanks!