Minimum list of useful bash shortcuts
December 08, 2019 · 3 mins to read
I often end up googling “bash shortcuts” and every result lists a huge list of shortcuts available in bash, some of them are overridden by other utils, like
fzf or by your terminal itself, some of them are not that helpful. I compiled the minimal list of shortcuts and commands which can increase your productivity in bash.
Note: MacOS iTerm 2 users must turn on meta key - https://coderwall.com/p/_lmivq
A good visual cheatsheat of shortucts taken from Clement Chastagnol’s article:
Also, in the description I’ll say how I memorize the shortcuts.
|Ctrl + a||Go to the beginning of the line.||
|Ctrl + e||Go to the end of the line.||
|Alt + b||Move cursor back one word, will jump to the current word’s first character or if already there to the previous word’s first character.||
|Alt + f||Move cursor forward one word, will jump to the next word’s first character.||
|Ctrl + x
||Toggle between the current cursor position and the beginning of the line. Very handy when you want fix typo in the program name and come back.|
|Ctrl + _||Undo.||just remember it’s Ctrl + Shift + -|
|Ctrl + u||Delete the line before the cursor.|
|Ctrl + k||Delete the line after the cursor.|
|Ctrl + w||Delete the word before the cursor.||
|Ctrl + y||Paste the last deleted item.||
|Ctrl + x, Ctrl + e||Edit the current command in your
|Ctrl + l||Clear screen||c
|Ctrl + z||Move current process to background. Use
|Ctrl + c||Send
|Ctrl + d||Exit the current shell (also works in SSH, so need to type
|Enter, ~, .||Exit stalled SSH session|
|Ctrl + r||Reverse search of bash history.||
All other shortcuts can be found in
man bash. To understand the syntax read
Readline Notation section first and then move on to
Commands for Moving.
Another helpful cheatsheat with Bash shortcuts and features can be found at fliptheweb/bash-shortcuts-cheat-sheet.