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.
Shortcut Description Memorization
Navigation
a is the 1st letter of
Ctrl + a Go to the beginning of the line. alphabet, hence the
beginning of the line.
Ctrl + e Go to the end of the line. e nd.
Move cursor back one word, will jump to the current word’s
Alt + b rst character or if already there to the previous word’s rst b ack.
character.
Move cursor forward one word, will jump to the next word’s
Alt + f f orward.
rst character.
Shortcut Description Memorization
Toggle between the current cursor position and the
Ctrl + x
beginning of the line. Very handy when you want x typo in
x
the program name and come back.
Edit
just remember it’s Ctrl
Ctrl + _ Undo.
+ 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. w ord.
Ctrl + y Paste the last deleted item. y ank.
Ctrl + x ,
Edit the current command in your $EDITOR .
Ctrl + e
Processes
Ctrl + l Clear screen c l s (hello BASIC)
Ctrl + z Move current process to background. Use fg to bring back. z Zzzz (sleep)
Ctrl + c Send SIGINT to the current process.
Exit the current shell (also works in SSH, so need to type
Ctrl + d d own
exit ).
Enter , ~ ,
Exit stalled SSH session
.
History
Ctrl + r Reverse search of bash history. r everse
All other shortcuts can be found in man bash . To understand the syntax read Readline Notation section
rst and then move on to Commands for Moving .
Another helpful cheatsheat with Bash shortcuts and features can be found at iptheweb/bash-shortcuts-
cheat-sheet.