Powershell equivalent of Ctrl+R?

Solution 1:

You can fix this by adopting the PSReadLine module.

See an article on the Hey, Scripting Guy! blog regarding this bash inspired readline implementation for PowerShell.

In particular, the usage of Ctrl+Alt+(Shift)+? to show all keybindings.

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10240.16384
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   10.0.10240.16384
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3

Ctrl+R

PS C:\> Get-Module -ListAvailable
bck-i-search: mo_

Ctrl+Alt+(Shift)+S

Key                  Function                 Description
---                  --------                 -----------
Ctrl+r               ReverseSearchHistory     Search history backwards interactively
Ctrl+s               ForwardSearchHistory     Search history forward interactively

In short: either install this module by hand or upgrade to Windows PowerShell v5.

Solution 2:

Type your search term and then press F8, this will search your command history.

There's a very useful list of PowerShell shortcuts here.


Solution 3:

I don't know when this got added, but on my non-customized, updated, Windows 10, it's built in. Hit ctrl+r for reverse history search, it works great.

enter image description here