PowerShell is Microsoft’s an automation platform with an interactive command-line shell and scripting language that allows administrators to simplify and automate administrative tasks. Previously it was just available for Windows OS but then Microsoft created a snap version of PowerShell for Linux users. Snaps are actually containerized applications that offer a single package that works across many Linux distributions.
Why install PowerShell on Linux?
While Linux provides already various proven command shells like bash, dash, and zsh, installing PowerShell might be useful nonetheless if you manage hybrid installations with Windows and Linux systems or if you just want to try it out – just for fun – or to learn PowerShell scripting.
Install PowerShell via Snap in Debian
In this article, we will explain how to install Microsoft PowerShell on Debian 10 using the snap image provided by Microsoft.
Use the following steps in order to install PowerShell via Snap.
Step 1: Open Terminal
First, you will need to launch Terminal in your Debian OS. To do so, go to the Activities tab in the top left corner of your desktop. Then from the search menu that appears, search for the Terminal application and launch it.
Step 2: Installation of Snap
We will first need to install Snap in our Debian system. Snap comes pre-installed in Debian 10. However, if you are using a previous version of Debian or if you have accidentally deleted it from your system, you can install it using the Terminal.
Open the Terminal and execute the following command as sudo to install Snapd:
$ sudo apt install snapd
When prompted for the password, enter sudo password and snapd will be installed on your system.
Once the snapd is installed on your system, you can then install PowerShell.
Step 3: Installation of PowerShell
Now in the Terminal, run the following command as sudo to install PowerShell:
$ snap install powershell --classic
The –classic option in the above command is required as the snaps are published with the classic confinement.
Wait for a while until the installation of PowerShell is completed.
Step 4: Launch PowerShell via Terminal
After the installation is completed, it’s time to launch Powershell. You will not find any icon of PowerShell in the application’s menu, however, we can launch it via Terminal.
Simply type the powershell or pwsh in the Terminal and you will find yourself in the MS PowerShell prompt.
To view the version of PowerShell installed, type the following command in the PowerShell prompt:
PowerShell is a great and powerful tool as compared to the standard command-line utility of Linux. Now you have learned how to install it in your Debian OS, you can start working with it exactly as you would on Windows.