Cancel the history search in Bash
In Bash and Zsh, press Ctrl+G on Mac, Linux, Windows. Works when: searching history.
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=deleteInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'return
ShiftZXCVBNM,./Shift↑
fnctrloptcmdcmdopt←↓→
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=BkspInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'Enter
ShiftZXCVBNM,./Shift↑
CtrlSuperAltAltSuperMenuCtrl←↓→
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=BkspInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'Enter
ShiftZXCVBNM,./Shift↑
CtrlWinAltAltWinMenuCtrl←↓→
See it happen Press the shortcut above, or
More Bash shortcuts: history
| Action | Mac | Linux | Windows |
|---|---|---|---|
| Search history backwards | CtrlR | CtrlR | CtrlR |
| Previous command | CtrlPor↑ | CtrlPor↑ | CtrlPor↑ |
| Next command | CtrlNor↓ | CtrlNor↓ | CtrlNor↓ |
| Insert the last argument of the previous command | Option. | Alt. | Alt. |
| Run the command and fetch the next from history | CtrlO | CtrlO | CtrlO |