Bash Shortcuts

  • Ctrl + C: Terminate the command
  • Ctrl + Z: Suspend the command
  • Ctrl + A: Move to the start of the line
  • Ctrl + E: Move to the end of the line
  • Ctrl + F: Move forward one character
  • Ctrl + B: Move backward one character
  • Ctrl + U: Delete from the cursor to the start of the line
  • Ctrl + K: Delete from the cursor to the end of the line
  • Ctrl + W: Delete from the cursor to the start of the word
  • Ctrl + D: Delete the character under the cursor
  • Ctrl + H: Delete the character before the cursor
  • Ctrl + T: Swap the character under the cursor with the previous one
  • Ctrl + L: Clear the screen

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 Form 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 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
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 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
Recall Last CommandCtrl + R
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 Current TaskCtrl + Z

The bash shortcuts will boost maximizing your productivity to around 90%. However, Bash is not the only shell out there. The one that can be the best alternative to bash is ZSH. It is a default shell in macOS. No doubt the experience of using this shell can be quite different. Dig into the ZSH shortcuts list.


https://tutorialtactic.com/keyboard-shortcuts/bash-shortcuts/

https://github.com/fliptheweb/bash-shortcuts-cheat-sheet

Built with Hugo
主题 StackJimmy 设计