60 Bash Keyboard Shortcuts

Software engineers and avid Bash enthusiasts must prioritize mastering the shell. Mastering Bash shortcuts can streamline processes and eliminate the need for tedious manual steps.

The Bash shell offers a wide range of shortcuts that are applicable across different operating systems. However, it’s important to note that some shortcuts may not function when accessing Bash remotely. Download the comprehensive list of Bash shortcuts in PDF format to enhance your proficiency.

Editing Shortcuts

ActionBash Shortcuts
TabCtrl + I
New LineCtrl + J
EnterCtrl + M
Paste the Last Thing to be CutCtrl + Y
UndoCtrl + _
Upper the case Every Character Form CursorAlt + U
Lower the case Every Character From the CursorAlt + L
Capitalize the Character Under Cursor and Move to the End of the WordAlt + C
Cancel Changes and Put Back the LineAlt + R
Delete Character Under CursorCtrl + D
Delete Character From LeftCtrl + H
Delete Word before CursorAlt + Delete
Delete Word after CursorAlt + D
Clear ScreenCtrl + L
EscapeCtrl + [
Cut Word Before Cursor to ClipboardCtrl + W
Cut Line After Cursor to ClipboardCtrl + K
Cut Line Before Cursor to ClipboardCtrl + U
Swap Current Word with PreviousAlt + T
Swap the Last Character before the CursorCtrl + T
Swap the Last Two Words Before the CursorEsc + T

Emacs and Vi Mode Shortcuts

ActionBash Shortcut keys
Set Emacs Mode$set -o emacs
Set Vi Mode$set -o vi

Navigation Shortcuts

ActionBash Shortcuts
Go to the Beginning of the LineHome
Go to the End of the LineEnd
Forward one characterCtrl + F
Backward one characterCtrl + B
Previous CommandCtrl + P
Next CommandCtrl + N
Back one wordAlt + B
Forward one wordAlt + F

Control Character Shortcuts

ActionBash Shortcuts
^@Ctrl + 2
^EscapeCtrl + 3
^\Ctrl + 4
^Ctrl + 5
^^Ctrl + 6
^_UndoCtrl + 7
^? Backward Delete CharacterCtrl + 8
Display Sequence for entering KeyCtrl + V

History Shortcuts

ActionBash Shortcuts
Recall Last CommandCtrl + R
Previous Command in HistoryCtrl + P
Next Command in HistoryCtrl + N
Go back to the Next Most Recent CommandCtrl + S
Escape from History Searching ModeCtrl + O
Repeat Last CommandCtrl + G
Run Last Command Starting with ABC!!
Print the last Command starting with ABC!abc
Last Argument of Previous Command!abc:p
Last Argument of Previous Command!$
All Arguments of Previous CommandAlt + .
Run Previous Command, replacing abc with def^abc^def

Process Controls Shortcuts

ActionBash Shortcuts
Interrupt or Kill Whatever you are runningCtrl + C
Clear ScreenCtrl + L
Stop Output to ScreenCtrl + S
Allow Output to ScreenCtrl + Q
Send an EOF MarkerCtrl + D
Send the signal SIGTSTP to the Current TaskCtrl + Z

Bash shortcuts can significantly enhance productivity, improving efficiency by up to 90%. However, Bash is not the only shell available. An excellent alternative to Bash is ZSH, which is the default shell in macOS. While the experience of using this shell may differ, it’s worth exploring.

READ NEXT:

Back to top button