PowerShell is a command-line shell designed specifically for system administrators to simplify and automate server management. It is a very powerful and efficient tool that saves a lot of time by automating the wide range of local and remote management tasks. Microsoft launched PowerShell Core as a snap for Linux users. Now you can try out PowerShell on Linux.
In this article, we will see how to install PowerShell as a snap in Ubuntu. We will use Ubuntu 18.04 LTS to describe the procedure mentioned in this article.
Installing snapd on Ubuntu
For launching PowerShell as a snap in Ubuntu, we will first need to install Snap. Snap comes pre-installed in Ubuntu 18.04 LTS and 19.04 LTS. However, if you are using an older version or if you have accidentally removed it from your system, you can install it using the Ubuntu Terminal.
To enable snapd, run the following command in Terminal:
$ sudo apt install snapd
Installing Powershell on Ubuntu
Then to install PowerShell using snap, run the following command in Terminal:
$ snap install powershell --classic
Enter the password for the current user account, then click on Authenticate.
The installation will take less than a minute.
After installing PowerShell, launch it from the Ubuntu’s Dash menu. Alternatively, just type pwsh in the Terminal. It will bring up the PowerShell command line.
Microsoft has also launched the preview version of PowerShell beta software. It is available as a separate snap.
To install PowerShell preview, run the following command in Terminal:
snap install powershell-preview –classic
Again enter the password for the user account, then click on Authenticate.
To launch PowerShell preview, just type the pwsh-preview in Terminal. It will bring up the PowerShell preview command line.
To view the version of PowerShell installed, run the following command in Terminal:
So, that was the brief overview of how to launch PowerShell as a Snap in Linux. Now you can use PowerShell as exactly as you would on Windows.