Wed. Aug 12th, 2020

How to install PowerShell Core in Linux

2 min read

PowerShell is built on top of the .NET Framework and is a task-based open-source command-line shell and scripting language. The goal is to become a ubiquitous language for managing hybrid cloud assets, which is one of the main reasons why Microsoft has promoted it from the Windows platform to the Linux and macOS system architecture.

Designed for system administrators and advanced users, PowerShell quickly and automatically manages multiple operating systems and applications running on the operating system and related processes. From now on, for the convenience of Linux platform users, PowerShell Core can be installed directly as a Linux Snap package.

The Snap package is a containerized package designed to work across cloud, desktop, and IoT devices. It works on most major Linux distributions, provides users with automatic updates, enhanced security, and greater flexibility for developers working in a Linux environment. For more information on the PowerShell Core Snap package, view on the Canonical blog.

What are the benefits of PowerShell Core support for Snap packages?

The Snap package has many advantages over traditional Linux packages such as DEB or RPM:

  • The Snap package comes with all the dependencies, so you don’t have to worry about installing a specific version of the shared library
  • No need to grant root privileges to install Snap packages
  • The Snap package can’t interact with other applications or system files without permission, so it can run very safely
  • Snap package can be updated automatically

How to install PowerShell Core through the Snap package

First, you need to make sure that snapd is installed.

Then execute the following command in Terminal to install:

snap install powershell –classic

To get the latest PowerShell preview, you can install it using the snap install powershell-preview –classic command.

After installing PowerShell Core through Snap, you can start it in the terminal using the pwsh command.