PowerShell keyboard shortcuts

PowerShell is Microsoft's command shell and scripting language, and its line editing comes from a module called PSReadLine. These keys move the cursor, edit the line, search history, complete commands, and select text, including Vi mode.

Windows, macOS, Linux · 60 shortcuts

Cursor movement

Move by character, word, line, brace, or numeric argument while editing the current PowerShell command.

ActionShortcuts
Move left one characterCtrl+B is Emacs mode only.
Windows / macOS / LinuxLeftorCtrl + B
Move right one characterCtrl+F is Emacs mode only.
Windows / macOS / LinuxRightorCtrl + F
Move back one wordWindows and Vi modes use Ctrl+Left. Emacs mode uses Alt+B.
WindowsCtrl + Left
macOS / LinuxAlt + B
Move forward one wordCtrl+Right (Windows and Vi modes) stops at the next word's start. Alt+F (Emacs mode) stops at the word's end.
WindowsCtrl + Right
macOS / LinuxAlt + F
Move to the start of the lineCtrl+A is Emacs mode only.
Windows / macOS / LinuxHomeorCtrl + A
Move to the end of the lineCtrl+E is Emacs mode only.
Windows / macOS / LinuxEndorCtrl + E
Go to the matching brace, parenthesis, or bracketWindows and Vi modes.
Windows / macOS / LinuxCtrl + ]
Move to the first non-blank characterVi command mode; underscore is an alternative.
Windows / macOS / Linux^
Start a numeric argument for the next actionAlt+0 through Alt+9 and Alt+- set the argument in Windows and Emacs modes.
Windows / macOS / LinuxAlt + 0

Editing the command line

Delete, insert, transform, transpose, accept, or cancel text before PowerShell evaluates the command.

ActionShortcuts
Delete the character before the cursorCtrl+H is Windows and Emacs mode.
Windows / macOS / LinuxBackspaceorCtrl + H
Delete the character under the cursor
Windows / macOS / LinuxDelete
Delete a character, or exit on an empty lineEmacs mode.
Windows / macOS / LinuxCtrl + D
Delete the previous word into the kill ringCtrl+Backspace and Ctrl+W are Windows mode; Alt+Backspace and Escape+Backspace are Emacs mode.
Windows / macOS / LinuxCtrl + BackspaceorCtrl + WorAlt + Backspace
Delete the next word into the kill ringAlt+D is Windows and Emacs mode; Ctrl+Delete is also bound in Windows and Vi modes.
Windows / macOS / LinuxAlt + DorCtrl + Delete
Delete from the start of input to the cursorEmacs mode; Ctrl+X then Backspace is an alternative.
Windows / macOS / LinuxCtrl + U
Delete from the cursor to the end of inputEmacs mode.
Windows / macOS / LinuxCtrl + K
Delete from the cursor to the end of input without the kill ringWindows and Vi modes.
Windows / macOS / LinuxCtrl + End
Copy selected text, or cancel the line if nothing is selectedWindows and Emacs modes.
Windows / macOS / LinuxCtrl + C
Cut the selected regionWindows mode.
Windows / macOS / LinuxCtrl + X
Paste from the system clipboardWindows mode; Vi insert mode uses Ctrl+V.
Windows / macOS / LinuxCtrl + VorShift + Insert
Undo the previous editCtrl+Z is Windows and Vi mode; the alternatives are Emacs mode.
Windows / macOS / LinuxCtrl + ZorCtrl + _orCtrl + X then Ctrl + U
Redo an undone editWindows and Vi modes.
Windows / macOS / LinuxCtrl + Y
Swap the current character with the previous oneEmacs and Vi insert modes.
Windows / macOS / LinuxCtrl + T
Capitalize the next wordEmacs mode. Escape then C is an alternative.
Windows / macOS / LinuxAlt + C
Convert the next word to uppercaseEmacs mode. Escape then U is an alternative.
Windows / macOS / LinuxAlt + U
Convert the next word to lowercaseEmacs mode. Escape then L is an alternative.
Windows / macOS / LinuxAlt + L
Accept and run the current lineCtrl+M is Emacs mode only.
Windows / macOS / LinuxEnterorCtrl + M
Insert a blank line aboveWindows mode.
Windows / macOS / LinuxCtrl + Enter
Insert a blank line belowWindows mode.
Windows / macOS / LinuxCtrl + Shift + Enter
Insert a new line in multiline input
Windows / macOS / LinuxShift + Enter

History

Recall, search, clear, and move through PowerShell history without retyping commands you already composed.

ActionShortcuts
Load the previous history entryCtrl+P is the Emacs alternative. Vi command mode also supports k and minus.
Windows / macOS / LinuxUporCtrl + P
Load the next history entryCtrl+N is the Emacs alternative. Vi command mode also supports j and plus.
Windows / macOS / LinuxDownorCtrl + N
Find the previous history entry matching the current prefixWindows mode.
Windows / macOS / LinuxF8
Find the next history entry matching the current prefixWindows mode.
Windows / macOS / LinuxShift + F8
Move to the first history itemEmacs mode.
Windows / macOS / LinuxAlt + <
Move to the current input at the end of historyEmacs mode.
Windows / macOS / LinuxAlt + >
Clear PSReadLine historyWindows mode. This doesn't affect PowerShell history.
Windows / macOS / LinuxAlt + F7

Completion and display

Complete commands, show a menu of possible completions, inspect parameter help, clear the screen, and capture text.

ActionShortcuts
Complete the text around the cursorEmacs mode. Windows mode uses Tab for TabCompleteNext.
Windows / macOS / LinuxTab
Display possible completionsAlt+= is Emacs mode; Ctrl+Space is Vi insert and command mode.
Windows / macOS / LinuxAlt + =orCtrl + Space
Select the next completionWindows mode and Vi command mode.
Windows / macOS / LinuxTab
Select the previous completionWindows mode and Vi insert or command mode.
Windows / macOS / LinuxShift + Tab
Show dynamic parameter help
Windows / macOS / LinuxAlt + H
Clear the screen and redraw the current line
Windows / macOS / LinuxCtrl + L
Start interactive screen captureThe function is unbound by default. Bind it with Set-PSReadLineKeyHandler if you need it.
Windows / macOS / LinuxNot documented

Selection and Vi mode

Select text, move through visual ranges, and use the mode-specific bindings that only appear in PSReadLine's Vi command layer.

ActionShortcuts
Select one character left
Windows / macOS / LinuxShift + Left
Select one character right
Windows / macOS / LinuxShift + Right
Select to the end of the line
Windows / macOS / LinuxShift + End
Select the next wordWindows mode.
Windows / macOS / LinuxShift + Ctrl + Right
Extend selection by the next wordEmacs mode. Plain Alt+F moves without selecting.
Windows / macOS / LinuxAlt + Shift + F
Set a mark at the cursorEmacs mode.
Windows / macOS / LinuxCtrl + @
Switch from Vi insert to Vi command modeVi mode.
Windows / macOS / LinuxEsc
Delete the current lineVi command mode.
Windows / macOS / Linuxd then d
Undo all edits for the lineVi command mode.
Windows / macOS / LinuxU
Open the current command in the external editorVi command mode; Emacs uses Ctrl+X then Ctrl+E.
Windows / macOS / Linuxv
Start a Vi history searchVi command mode. The search starts after you accept the search text.
Windows / macOS / Linux/
Paste before the cursorVi command mode.
Windows / macOS / LinuxP
Paste after the cursorVi command mode.
Windows / macOS / Linuxp

Source

official Microsoft PSReadLine functions · Checked

Defaults depend on your PSReadLine edit mode: Windows on Windows, Emacs elsewhere. Run Get-PSReadLineKeyHandler to see your exact keys.

Make a printable PowerShell sheet