PowerShell has been a staple of Windows for many years but in recent times Microsoft has made a pretty substantial change to it. It's now both open source and cross-platform, available not only on Windows but also on macOS and Linux.
This new version is the future of PowerShell and whether you want to use it on Linux professionally, to learn, or just to poke around with, it's not too difficult to get installed.
Here's what you need to know.
Downloading and installing PowerShell on Linux
While PowerShell on Linux isn't exactly the same as on Windows — modules and commands specific to Windows aren't usable — it's available for folks who need it. Microsoft is moving away from Windows PowerShell and into this cross-platform affair.
We'll be installing PowerShell 7, and the process is really straightforward.
- Go to the PowerShell release page.
- Download the installer that matches your Linux distro.
- Locate the downloaded file on your machine.
- Double click to install.
A fairly short installation process will now occur, using a software installer that may vary depending on which distro you're using.
Powershell being a command-line tool on Linux and not a traditional application means you won't be able to launch it directly from your desktop GUI. Instead, you'll launch it from the terminal.
If you're on Arch Linux you can install PowerShell from the AUR by grabbing the latest release binary.
You could also use the Snap Store to install PowerShell if that's a way you like to get your packages.
snap install powershell --classic
One final word is that the official Microsoft documentation says that PowerShell 7 isn't supported on Ubuntu 20.04 LTS, but that's not really the case. Whether it's a missing update to the text or it just works anyway, PowerShell in this guide was installed on Ubuntu 20.04. Admittedly there were some issues using the direct download but the Snap install works just fine.
How to launch PowerShell inside the terminal
You may see PowerShell in your app drawer but to use it, open up a new terminal window and enter this simple command.
You'll now see a short bit of blurb beginning with the PowerShell version, and your command line will change from yourusername@yourlinuxmachine to PS /home/yourusername.
You're now all set to use PowerShell on your Linux machine. Any time you want to use it, simply enter the command to launch it and exit out when you're done by typing exit.
But if you're going to use it a lot, you might want to set it as the default shell for your Linux terminal.
Setting PowerShell as the default terminal shell
PowerShell's bonus is that it doesn't totally replace and overwrite your existing shell; any Linux commands you could normally enter can also be entered in PowerShell. As such, if you're going to use PowerShell a lot, you can set it as your default shell and not worry about losing any functionality.
There are a few different ways you can achieve this, but one of the easiest is by changing the default in
and if you installed it as a Snap then there's a slight difference to the steps.
First up, it's a good idea to make sure PowerShell is added as a valid login shell in
- In the terminal enter
sudo nano /etc/shells(substituting nano for your preferred text editor as required).
- If you see an entry for pwsh then you're good and can close the file.
- If you need to add PowerShell, type
/usr/bin/pwshto the end of the text file.
- If you installed via Snap, add
- Close out of nano by pressing ctrl + X and selecting yes to save.
Next, in the terminal, follow these steps.
sudo nano /etc/passwd(again, substitute nano for your preferred text editor as required).
- Scroll towards the bottom until you see an entry that ends in
- Change this to either
/bin/pwshor if you installed from Snap
- Exit and save the file.
- Log out of your PC and log back in.
Once logged back in opening a new terminal window should now immediately present you with PowerShell in place of the standard bash shell.
Richard Devine is an Editor at Windows Central. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently you'll find him covering all manner of PC hardware and gaming, and you can follow him on Twitter and Instagram.
Get the best of Windows Central in in your inbox, every day!
Thank you for signing up to Windows Central. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.