Install PowerShell on Windows Subsystem for Linux Ubuntu Distro

Photo of author

By Victor Ashiedu

Published

Do you want to install PowerShell on your Windows Subsystem for the Linux Ubuntu distro? Follow these quick steps:

  1. Open CMD on Windows Terminal:
To open Windows Terminal search “terminal,” and click the app from the search result. After that click the drop-down on the Terminal (if CMD is not your default Terminal profile) and select Command Prompt – see the screenshots below.
Install PowerShell on Windows Subsystem for Linux (WSL) Ubuntu
setup PowerShell on Windows Subsystem for Linux Ubuntu Distro
  1. After CMD opens, run the “wsl –list” command to display the Linux distros available on the Windows Subsystem for Linux.
wsl --list
  1. Then, execute the command below to launch the Ubuntu distro you want to install PowerShell – this signs into the distro as root:
wsl --distribution Ubuntu-20.04 -u root

The above command launches the Ubuntu distro, “Ubuntu-20.04”.

  1. After that, update the Ubuntu package manager by running the “apt update” command.
apt update
  1. Then, get the command to install PowerShell by running the “powershell” command from the Ubuntu terminal.

Ubuntu returns a message “Command ‘powershell’ not found, but can be installed with:”

Then, it displays the command you need to run to install PowerShell on the Ubuntu WSL distro.

To install PowerShell on your WSL Ubuntu distribution, run the highlighted command. I included the –classic argument for Ubuntu to allow the installation.

If you do not include the –classic argument, Ubuntu displays a warning about “ snap “powershell” being published using classic confinement.”
snap install powershell --classic

After installing PowerShell on Windows Subsystem for Linux Ubuntu Distro, start the app by running the “pwsh” command. This will start PowerShell 7.

Once PowerShell launches, you can run any available command. In my screenshot below, I ran the “Get-ChildItem” command on the /home/ directory.

set up PowerShell on Windows Subsystem for Linux Ubuntu Distro

We hope you found this quick step-by-step guide helpful. Kindly share your thoughts – feedback, questions, or comments – using the comments form at the end of this page.

Alternatively, you can respond to the “Was this page helpful?” question below.

About the Author

Photo of author

Victor Ashiedu

Victor is the founder of InfoPress Media, publishers of Ilifeguides and Itechguides. With 20+ years of experience in IT infrastructure, his expertise spans Windows, Linux, and DevOps. Explore his contributions on Itechguides.com for insightful how-to guides and product reviews.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend