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.
01Command
$ Set-PSReadLineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory ; Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward02What 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
04Undo
$ Remove-PSReadLineKeyHandler -Key Ctrl+r ; Remove-PSReadLineKeyHandler -Key UpArrow05Sources
- about_PSReadLineEvidence: Documents PSReadLine key handlers including ReverseSearchHistory, HistorySearchBackward and how custom bindings persist via $PROFILE.
Last verified: 2026-09-17 · Category: Developer
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Create or update a .zip from any files or folder contents straight from PowerShell.
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.