Srikanth Venugopalan
Srikanth Venugopalan

Reputation: 9049

PowerShell history of commands

I use Bash and PowerShell interchangeably, and find it quite annoying when I can't do a Ctrl+R on my PowerShell Console.

Is there a plugin/alternate command that can help me switch between Bash and PowerShell seamlessly?

Update (2018)

PowerShell now supports Ctrl + R. Please see this answer.

Upvotes: 11

Views: 10946

Answers (3)

Mwiza
Mwiza

Reputation: 8961

Use the Ctrl + R shortcut.

Simply press Ctrl + R when in the PowerShell console and start typing any part of a command you have run before.


Alternatively:

Start typing part of a command you have run before, and press or hit F8.

Keep pressing F8 to cycle through similar commands.

Upvotes: 10

Keith Hill
Keith Hill

Reputation: 201662

An alternate command is to type e.g #ls and press Tab keep pressing tab to cycle through all command history that starts with ls.

In previous versions you could type ls then F8 to match history. Keep pressing F8 to cycle through multiple matches.

Note:ls is just a placeholder in this case. Replace it with any command you want.

Upvotes: 17

Jason Shirk
Jason Shirk

Reputation: 8019

Take a look at PSReadline: https://github.com/lzybkr/PSReadLine

This module supports interactive history search in emacs mode and you can bind Ctrl+R to ReverseHistorySearch in Windows mode if you prefer.

The long term goal of PSReadline is to make it much easier to switch from bash to PowerShell w.r.t. command line editing while providing a PowerShell experience, e.g. tab completion.

Upvotes: 5

Related Questions