PowerShell is a Microsoft automation platform with an interactive command line shell and scripting language that allows administrators to simplify and automate administrative tasks. Previously, it was only available for Windows, but then Microsoft created a version of PowerShell for Linux users. Snapshots are actually containerized applications that offer a single package that runs on many Linux distributions.
Why install PowerShell on Linux?
Although Linux already provides various proven shells, such as bash, dash, and zsh, installing PowerShell can be useful, however, if you run hybrid installations with Windows and Linux systems or if you just want to try it – just for fun – or explore PowerShell scripts.
Install PowerShell via Snap in Debian
In this article, we will explain how to install Microsoft PowerShell on Debian 10 using the snap-in image provided by Microsoft.
Use the following steps to install PowerShell through Snap.
Step 1: Open Terminal
First, you need to run Terminal on your Debian OS. To do this, go to the “Actions” tab in the upper left corner of the desktop. Then, in the search menu that appears, find the Terminal application and launch it.
Step 2: Install Snap
First we need to install Snap on our Debian system. Snap comes pre-installed with Debian 10. However, if you are using a previous version of Debian or accidentally removed it from your system, you can install it using the terminal.
Open Terminal and run the following command as sudo to install Snapd:
$ sudo apt install snapd
When a password is requested, enter sudo password and Snapd will be installed on your system.
After the snap-in is installed on your system, you can install PowerShell.
Step 3. Install PowerShell
Now in Terminal, run the following command as sudo to install PowerShell:
$ snap install powershell --classic
The –classic parameter in the above command is necessary, because pictures are published with a classic restriction.
Wait for a while until the PowerShell installation is complete.
Step 4: Launch PowerShell via Terminal
After the installation is complete, it’s time to start Powershell. You will not find any PowerShell icon in the application menu, however we can launch it through the terminal.
Just enter powershell or pwsh in the Terminal and you will find yourself at the MS PowerShell command prompt.
To view the installed version of PowerShell, at the PowerShell prompt, type the following command:
PowerShell is a great and powerful tool compared to the standard Linux command line utility. Now you have learned how to install it on your Debian OS, and you can start working with it just like on Windows.
How to install Microsoft PowerShell in Debian 10