Skip to content

↑↓ moveEnter openEsc close

Bash keyboard shortcuts

Bash Bash 5.2 / Zsh 5.9 · 36 shortcuts · checked Nov 2026 · Source: GNU Project docs

Bash and Zsh use the same Emacs-style line editing keys in every terminal: on Linux, in the macOS Terminal and in WSL or Git Bash on Windows. They move the cursor, cut and paste words, search history and control running programs.

Most used Bash keyboard shortcuts

The Bash shortcuts worth learning first. The full list follows, grouped by task.

36 shortcuts

Small screen: your system's keys only. Pick another system in the tabs above.

ActionMacLinuxWindows
Go to the start of the lineCtrlACtrlACtrlA
Go to the end of the lineCtrlECtrlECtrlE
Back one wordOptionBAltBAltB
Forward one wordOptionFAltFAltF
Back one characterCtrlBCtrlBCtrlB
Forward one characterCtrlFCtrlFCtrlF
Jump between the start of the line and the cursorCtrlX,CtrlXCtrlX,CtrlXCtrlX,CtrlX
ActionMacLinuxWindows
Cut from the cursor to the start of the lineCtrlUCtrlUCtrlU
Cut from the cursor to the end of the lineCtrlKCtrlKCtrlK
Cut the word before the cursorCtrlWCtrlWCtrlW
Cut the word after the cursorOptionDAltDAltD
Paste the last cut textCtrlYCtrlYCtrlY
Delete the character before the cursorCtrlHCtrlHCtrlH
Delete the character under the cursorLine has textCtrlDCtrlDCtrlD
Swap the last two charactersCtrlTCtrlTCtrlT
Swap the last two wordsOptionTAltTAltT
Uppercase the wordOptionUAltUAltU
Lowercase the wordOptionLAltLAltL
Capitalise the wordOptionCAltCAltC
Undo the last editCtrlX,CtrlUCtrlX,CtrlUCtrlX,CtrlU
Edit the command in your editorCtrlX,CtrlECtrlX,CtrlECtrlX,CtrlE

History

6 shortcuts
ActionMacLinuxWindows
Search history backwardsCtrlRCtrlRCtrlR
Previous commandCtrlPor↑CtrlPor↑CtrlPor↑
Next commandCtrlNor↓CtrlNor↓CtrlNor↓
Insert the last argument of the previous commandOption.Alt.Alt.
Run the command and fetch the next from historyCtrlOCtrlOCtrlO

Completion

2 shortcuts
ActionMacLinuxWindows
Complete the command or file nameTabTabTab
List all completionsTab,TabTab,TabTab,Tab
ActionMacLinuxWindows
Stop the running programCtrlCCtrlCCtrlC
Suspend the running programCtrlZCtrlZCtrlZ
Quit the program and dump coreCtrl\Ctrl\Ctrl\
End of input; exits the shell on an empty lineEmpty lineCtrlDCtrlDCtrlD
Clear the screenCtrlLCtrlLCtrlL
Pause outputCtrlSCtrlSCtrlS
Resume outputCtrlQCtrlQCtrlQ
Show the key map: which keys Bash uses mostDarker orange = used by more shortcuts

Using the Alt shortcuts in the Mac Terminal

Shortcuts written with Option on a Mac send the Meta key. The macOS Terminal does not do that out of the box.

Terminal
Open Terminal > Settings > Profiles > Keyboard and tick Use Option as Meta key.
iTerm2
Open Settings > Profiles > Keys and set Left Option key to Esc+.
Without the setting
Press Esc and then the letter instead: Esc then B moves back one word.

Bash keyboard shortcuts: questions

How do I search my command history in the terminal?
Press Ctrl+R and start typing: the most recent matching command appears. Press Ctrl+R again for older matches, Enter to run it, or Ctrl+G to give up.
What does Ctrl+Z do in the terminal?
It suspends the running program and returns you to the prompt. Type fg to bring it back to the foreground or bg to keep it running in the background.

These are the default key bindings in Bash and Zsh Bash 5.2 / Zsh 5.9, as published by GNU Project. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.

Single-system lists: Bash keyboard shortcuts for Mac, Bash keyboard shortcuts for Linux, Bash keyboard shortcuts for Windows.

Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.