Microsoft has released its command-line shell and scripting language PowerShell Core for Linux operating system as a Snap package which makes it easier for Linux users to install Microsoft PowerShell on their system.
PowerShell Core is a cross-platform version of Windows PowerShell that is already available for Windows, macOS, and Linux OS and has been designed for sysadmins who manage assets in hybrid clouds and heterogeneous environments.
Snap is a universal Linux packaging system built for the Ubuntu operating system, which makes an application compatible for all major Linux distributions without requiring any modification. Snap packages are applications compressed together with its dependencies and has instructions on how to run it. It can be installed on many Linux distributions. Snap packages have numerous benefits over traditional Linux software packages
- Snap packages carry all of their own dependencies, so the user need not have to worry about the specific versions of shared libraries installed in their machine.
- It can be installed without giving the publisher root access to the host
- They are safe to run as they don’t interact with other applications or system files without your permission
- Snap updates are done automatically.
How to Install PowerShell Core on Linux
To install Microsoft PowerShell Core as a snap package on a Linux-based OS, first install snapd and then run the following command.
snap install powershell –classic
After installation, open a terminal and run the command pwsh.
An alternative method is to go to this webpage and install PowerShell Core snap app on your system.
If you are interested to try the beta software, run the below command from the terminal.
snap install powershell-preview –classic