PowerShell is Microsoft’s answer to the Unix command-line. It’s powerful and primarily targeted at developers looking for a rock solid command-line and scripting framework.
The PowerShell tool and framework isn’t exclusive to Windows users. To the surprise of many, Microsoft has made it possible to use their PowerShell platform on other operating systems, including Linux.
While a majority of Linux users focus on the Unix command-line that all distributions have to offer, it’s nice to see Microsoft putting Windows-related tools, such as PowerShell on the platform, so that Linux users who need to use Powershell don’t need to use Microsoft’s operating system. Here’s how to get Powershell on Linux.
Install PowerShell on Linux
On Linux, Microsoft has given Linux users many different ways to enjoy PowerShell. As of now, there’s a DEB package for Ubuntu and Debian, an RPM for Fedora, SUSE, CentOS (and other RedHat OSes,) an unofficial AUR package and even a Snap available for installation.
To get PowerShell working on your Linux PC, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow along with the instructions that match the Linux distribution you are currently using.
It’s true that since Ubuntu comes with Snap by default, users should probably install the Snap release instead of fussing with the PowerShell DEB release. However, not every Ubuntu user likes to use Snaps, so it’s nice to see there’s an alternative way to install the software.
To get your hands on the PowerShell Debian package for your Ubuntu PC, use the wget downloader tool.
With the package file is done downloading, it’s time to install it to Ubuntu. To do this, use the dpkg command.
sudo dpkg -i powershell_*_amd64.deb
Following the installation of the PowerShell DEB package on Ubuntu, you may see errors that appear in the command-line prompt. Don’t worry; these errors are likely just dependency issues. To fix them, use the apt install command below.
sudo apt install -f
Assuming apt install runs successfully, you’ll be able to access PowerShell on Ubuntu!
Microsoft does support Debian users with a PowerShell DEB package, however officially, they’ve only released one for Debian 9 Stable. It’s okay, as most users aren’t on 10 yet, but if you do use 10, skip these instructions in favor of the Snap method instead.
To get PowerShell working on Debian 9, launch a terminal window. From there, run the following wget download command to grab the latest DEB release of the app.
When the DEB package is done downloading to your Debian PC, it’s time to start the installation. To do this, run dpkg.
sudo dpkg -i powershell_*_amd64.deb
After running the dpkg command, Debian may experience dependency issues. To fix this, you can run apt-get install.
sudo apt-get install -f
Once your dependency issues are corrected (if there were any), PowerShell will be ready to use!
Microsoft’s PowerShell is on the Arch Linux AUR, so if you’re looking to install it on your Arch PC, you’re in luck. To start the installation, open up a terminal and use the Pacman package to download Git and Base-devel to the system.
sudo pacman -S git base-devel
Following Git and Base-devel, clone the latest Trizen AUR snapshot, to make installing PowerShell easy.
git clone https://aur.archlinux.org/trizen.git
Install Trizen to the system using makepkg.
Finally, install the latest release of Microsoft PowerShell on Arch Linux.
trizen -S powershell
Microsoft has released an RPM package for both RedHat Enterprise Linux 7, and Fedora which can be used to install PowerShell. To get your hands on this RPM package file, use wget to download it. Then, install with Dnf.
wget https://github.com/PowerShell/PowerShell/releases/download/v6.2.0/powershell-6.2.0-1.rhel.7.x86_64.rpm sudo dnf install powershell-6.2.0-1.rhel.7.x86_64.rpm
There’s an RPM package of PowerShell ready to install on OpenSUSE Leap 42.3, so those on SUSE are in luck. However, if you’re using 15.0 or Tumbleweed, consider the Snap instructions instead.
To install PowerShell on SUSE 42.3, start by using the wget tool to download the latest RPM file.
Once the download is complete, use Zypper to install the package.
sudo zypper install powershell-6.2.0-1.rhel.7.x86_64.rpm
Aside from generating several packages for various Linux distributions, Microsoft has also chosen to upload PowerShell to the Snap package store. So, if you’re running a Linux distribution that supports Snaps, you’re in luck!
To install the Snap release of PowerShell, follow this guide to learn how to set up Snapd on your system. Then, install the latest release of Microsoft PowerShell with the snap install command below.
sudo snap install powershell --classic
To access Microsoft PowerShell on Linux, fire up your favorite Linux terminal application. Once the app is open, run the command below.
For help with PowerShell, run: