Skip to content

↑↓ moveEnter openEsc close

Cancel the history search in Bash

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

In Bash and Zsh, press Ctrl+G on Mac, Linux, Windows. Works when: searching history.

What else uses Ctrl+G?

More Bash shortcuts: history

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

All 36 Bash shortcuts