Ctrl+R History Search in PowerShell (PSReadLine)

PSReadLine can replicate bash's Ctrl+R, and its HistorySearch functions filter history as you type — most users never enable them.

WindowsclipowershellproductivityLow risk
Bind ReverseSearchHistory to Ctrl+r and HistorySearchBackward to UpArrow with Set-PSReadLineKeyHandler, then store it in $PROFILE.

01Command

Command
$ Set-PSReadLineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory ; Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward

02What it does

PSReadLine stores an unlimited, persistent history file, but its best features are opt-in key handlers. ReverseSearchHistory gives incremental Ctrl+R matching, while HistorySearchBackward on the Up arrow is even better: typing a prefix like 'docker' then pressing Up cycles only through commands starting with it. Put the bindings in $PROFILE so they load in every session.

03Risk

RiskLow risk
RequirementsPSReadLine module (bundled with Windows PowerShell 5.1+); add the commands to $PROFILE to persist

04Undo

Undo
$ Remove-PSReadLineKeyHandler -Key Ctrl+r ; Remove-PSReadLineKeyHandler -Key UpArrow

05Sources

  • about_PSReadLine
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents PSReadLine key handlers including ReverseSearchHistory, HistorySearchBackward and how custom bindings persist via $PROFILE.

Last verified: 2026-09-17 · Category: Developer

06Related solutions