Skip to content

How to get more out of your PowerShell console with PSReadLine

Andrew Pla
Andrew Pla|March 5, 2026
Illustration of Power(turtle)Shell
Illustration of Power(turtle)Shell

TL;DR: PSReadLine powers much of PowerShell’s interactive console, including command editing, history search, syntax highlighting, completions, predictions, and key bindings. This post covers the most useful shortcuts, shows how to view and change PSReadLine options, and explains how to persist your customizations by adding them to your PowerShell profile.

PSReadLine is the module that powers the interactive command line experience in PowerShell. It provides command editing, history search, syntax highlighting, predictions, and customizable keyboard shortcuts inside the PowerShell console.

Most PowerShell users are already using PSReadLine without realizing it. If you’ve ever used the up arrow key to go through previous commands, PSReadLine makes that possible.

In other words: A lot of what makes the PowerShell console feel friendly and modern comes from PSReadLine.

In this post we’ll take a quick look at:

  • What PSReadLine is already doing for you

  • A few shortcuts that can make your console workflow faster

  • How to start customizing it

I presented this at PowerShell Wednesday (in emo costume) if you want to see the video version of this:

Loading...

What is PSReadLine in PowerShell?

PSReadLine replaces PowerShell’s default command line editor with an enhanced interactive editor.

It provides:

  • Command line editing (cursor movement, selection, undo, delete)

  • Command history and history search

  • Syntax highlighting and inline error indicators

  • Command completion including menu completion

  • Command prediction suggestions

  • Custom key bindings and console behavior settings

You can check out the PSReadLine Github or read the help docs:

help about_psreadline

PSReadLine has come installed with PowerShell since version 5.0, but you can check the current version that you have to make sure that you are on the latest and greatest . At the time of me writing this, I’m on 2.4.5.

Get-Module PSReadLine

If you want the newest version:

Install-Module PSReadLine -Scope CurrentUser -Force

Restart PowerShell after installing.

ConnectIcon CTA

Easily run PowerShell scripts on remote devices

Need to run your awesome PowerShell scripts on remote devices? PDQ Connect can easily execute PowerShell scripts on any managed device with an active internet connection. 

Common PSReadLine features you are probably already using

Many things people associate with “PowerShell” are actually PSReadLine features.

Up arrow → command history

Run a few commands:

Now press the up arrow to cycle through the previous commands.

Tab completion

Example:

Get-Pro

Press Tab to complete the command.

You can also browse completion results using:

Ctrl + Space

This shows completion results as a menu.

If Ctrl + Space does nothing in your terminal (common on macOS terminal setups), I had success setting the key handlers with: Set-PSReadLineKeyHandler -Key 'Ctrl+@' -Function MenuComplete

Syntax highlighting

When you type commands, PowerShell highlights different parts of the syntax.

Example: Get-Process -Name ‘Google Chrome’

Get-Process -Name ‘Google Chrome’

PSReadLine parses the command and applies colors to:

  • Commands

  • Parameters

  • Strings

  • Errors

PSReadLine shortcut cheat sheet

You don’t need to learn dozens of shortcuts. Start with these:

Shortcut

Function

Ctrl + R

Search command history

Alt + .

Insert last argument from previous command

Ctrl + A

Move to beginning of line

Ctrl + E

Move to end of line

Ctrl + L

Clear the screen

Ctrl + Space

Open menu completion

Instead of scrolling through commands, search them: Press Ctrl + R. Then, start typing part of a command like: proc. PowerShell will search for commands containing that text. Press Ctrl + R again to cycle through matches.

Pres Alt + . to reuse the last argument. This shortcut inserts the last argument from the previous command.

Example:

notepad C:\temp\test.txt

Then type:

Copy-Item

Press Alt + .

PowerShell inserts:

C:\temp\test.txt

How do I view PSReadLine options?

You can inspect your current configuration with:

Get-PSReadLineOption

This displays settings like:

  • History configuration

  • Prediction behavior

  • Editing mode

  • Syntax colors

How do I change PSReadLine behavior?

Example: Enable list-style predictions.

Set-PSReadLineOption -PredictionViewStyle ListView

Now start typing: Get-

You’ll see a list of suggestions you can navigate.

PowerShell terminal showing command history suggestions after typing get, including commands like Get-Process and Get-PSReadLineKeyHandler with predictive history enabled.

How do I view key bindings?

PSReadLine includes many built-in keyboard shortcuts, also called key bindings.

View them with:

Get-PSReadLineKeyHandler

This shows:

  • The key combination

  • The function it triggers

  • A description

How do I create custom key handlers?

You can bind keys to PowerShell logic.

Example:

Set-PSReadLineKeyHandler -Key F2 -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::Insert((Get-Date).ToString()) }

Press F2 and the current date is inserted into the command line.

Set-PSReadLineKeyHandler -Key F3 -ScriptBlock { $joke = (Invoke-RestMethod https://icanhazdadjoke.com/ -Headers @{ Accept = 'application/json' }).joke [Microsoft.PowerShell.PSConsoleReadLine]::Insert($joke) }

With this example, if you press F3, a lovely dad joke will be put right where your cursor is. That's a silly example, but you can run any code you want there. The world is your oyster!

This next example is sneakily helpful:

Set-PSReadlineKeyHandler -Key Enter -Function ValidateAndAcceptLine

This makes it so that instead of just running code when we press enter, it actually validates that it's real code before executing it. If you type Fake-Command and press enter, it will not excecute the code, so now you can fix the error. You can also just completely ignore the warning and press enter again and it'll run. It's a win-win situation.

PowerShell window showing an error after running Fake-Command, with the message: “Command 'Fake-Command' cannot be found.”

Once your profile is open, you can start adding PSReadLine settings.

Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadlineKeyHandler -Key Enter -Function ValidateAndAcceptLine Set-PSReadLineKeyHandler -Key F3 -ScriptBlock { $joke = (Invoke-RestMethod https://icanhazdadjoke.com/ -Headers @{ Accept = 'application/json' }).joke [Microsoft.PowerShell.PSConsoleReadLine]::Insert($joke) }

How do I make PSReadLine changes permanent with my PowerShell profile?

By default, PSReadLine changes only apply to the current PowerShell session.

To make those changes permanent, you need to put them in your PowerShell profile. Your profile is simply a script that runs every time PowerShell starts. PowerShell profiles are just .ps1 scripts that allow you to customize your environment. Common things people add to their profile include:

  • PSReadLine configuration

  • Aliases

  • Helper functions

  • Environment settings

  • Module imports

If you plan to customize your terminal experience, your profile becomes your best friend.

How do I create my profile?

If you’re brand new and just want something quick to get started, you can create your profile with:

New-Item $PROFILE.CurrentUserAllHosts -ItemType File -Force Invoke-Item $PROFILE.CurrentUserAllHosts

This will:

  1. Create the profile if it doesn’t exist

  2. Open it in your system’s default .ps1 editor

Once your profile is open, you can start adding PSReadLine settings.

Set-PSReadLineOption -PredictionViewStyle ListView

If you are ready for some serious customization and motivation, check out the example profile from the PSReadLine GitHub.

Where to start

If you’re new to PSReadLine, start with these:

  • Ctrl + R → history search

  • Alt + . → reuse last argument

  • Ctrl + A /Ctrl + E → navigate commands

  • Ctrl + Space → menu completion

Once those become muscle memory, explore more customization options.

Final thoughts

PSReadLine runs automatically every time you start PowerShell and provides powerful tools for customizing your command line workflow. By adding PSReadLine settings to your PowerShell profile, you can permanently improve how your console behaves.

Start small, experiment, and add things over time.

Andrew Pla
Andrew Pla

Andrew loves automation, PowerShell, and building tools that last. He has spent nearly a decade in IT with a focus on automation, infrastructure, and toolmaking. He has a passion for sharing knowledge and prefers humans to computers, and is a host of the PowerShell Podcast and a Microsoft MVP.

Related articles