PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell also serves as the replacement for Microsoft’s Command Prompt, which dates back to DOS.
The PowerShell language, similar to Perl, offers several ways to automate tasks. It was made open-source and cross-platform (Available for Microsoft Windows, Linux, and macOS) on 18 August 2016 with the introduction of PowerShell Core.
As a scripting language, PowerShell is a robust solution that helps users automate a range of tedious or time-consuming administrative tasks and find, filter, and export information about the computers on a network and commonly used for automating the management of systems.
It is also used to build, test, and deploy solutions, often in CI/CD environments.
PowerShell is built on the .NET Common Language Runtime (CLR). All inputs and outputs are .NET objects. No need to parse text output to extract information from output.
In PowerShell, administrative tasks are generally performed by cmdlets, which are specialized .NET classes implementing a particular operation.
These work by accessing data in different data stores, like the file system or registry, which are made available to PowerShell via providers. Third-party developers can add cmdlets and providers to PowerShell. Cmdlets may be used by scripts, which may in turn be packaged into modules.

Key Features of PowerShell
- Extensible formatting system for easy output
- Extensible through functions, classes, scripts, and modules
- Built-in support for common data formats like CSV, JSON, and XML
- Extensible type system for creating dynamic types
- Supports command and parameter aliases
- In-console help system, similar to Unix man pages
- Robust command-line history
- Tab completion and command prediction
- Pipeline for chaining commands
- PowerShell provides error-handling mechanism through the
Try{ }
,Catch{ }
, andFinally { }
statements as in .NET languages. - Robust Session Connectivity
This article explains three methods of installing Microsoft PowerShell on Ubuntu 20.04.
Choose the installation method that is most appropriate for your environment.
Method 1: Installing PowerShell as a Snap Package
The easiest way to install Microsoft PowerShell on Ubuntu 20.04 is by using the snap packaging system.
The PowerShell snap package is distributed and maintained by the Microsoft Corporation.
A snap package is a type of universal Linux package that you can enjoy irrespective of the distro. Its an self-contained software packages that include the binary all dependencies needed to run the application.
All you need is the snap service pre-configured, In the case of Ubuntu 20.04, it comes with snap pre-installed.
If snapd package is not already installed then you can install it by running following command.
$ sudo apt install snapd
Note: Snap packages can be installed from either the command-line or via the Ubuntu Software application.
This is actually the Snap version of the PowerShell application. It can be used on any Linux distribution that has Snap support.
Open your terminal (Ctrl+Alt+T
) and type the following command to install the PowerShell package.
$ sudo snap install powershell --classic
The --classic
option is required because the PowerShell snap requires full access to the system, like a traditionally packaged application.
To install a preview version of PowerShell, use the following commands.
$ sudo snap install powershell-preview --classic
That’s It. Now you can open the PowerShell application with the help of Activities search bar.
If you are not comfortable with the command line, open Ubuntu Software, search for “PowerShell” and install the application.

Type the following command to update the Microsoft PowerShell.
$ sudo snap refresh --list
Method 2: Installing PowerShell via Package Repository
PowerShell for Linux is published to package repositories for easy installation and updates. Use the following shell commands to install PowerShell on Ubuntu 20.04.
Step #1
Type the following command to update the list of packages.
$ sudo apt-get update
Step #2
Install pre-requisite packages.
$ sudo apt-get install -y wget apt-transport-https software-properties-common
Step #3
Download the Microsoft repository GPG keys.
Following command will automatically find your current Ubuntu version as we are using $(lsb_release -rs)
and download the package accordingly.
$ wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
OR you can explicitly mention Ubuntu version. For example here I am downloading the package for Ubuntu 20.04.
$ wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
Both commands will do the same thing.
Step #4
Register the Microsoft repository GPG keys.
$ sudo dpkg -i packages-microsoft-prod.deb
Step #5
Update the list of packages after we added packages.microsoft.com
$ sudo apt-get update
Step #6
Finally, type the following command to install PowerShell.
$ sudo apt-get install -y powershell
Method 3: Install PowerShell using deb package(Direct Download)
Step #1
Download the PowerShell .deb
package file using wget
command as follows.
$ wget https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell_7.1.5-1.ubuntu.20.04_amd64.deb
Step #2
Now type the following command to install the downloaded package.
$ sudo dpkg -i powershell_7.1.5-1.ubuntu.20.04_amd64.deb
If necessary run the following command to resolve missing dependencies and finish the install.
$ sudo apt-get install -f
To check the PowerShell version installed in your system type the following command.
$PSVersionTable
Starting PowerShell
Microsoft PowerShell can be launched from the command line by typing pwsh
or In the Activities search bar type “powershell” and click on the icon.

Issue the following command to start the Powershell Preview version (If you have installed a preview release).
$ pwsh-preview
How to Uninstall PowerShell from Ubuntu 20.04
For some reason, If you want to uninstall Microsoft PowerShell application, refer following methods.
Method #1
If you have installed PowerShell via Snap type the following command:
$ sudo snap remove powershell
Method #2
If you have installed the appication via Package Repository or direct .deb
package then uninstall by running the below command:
$ sudo apt-get remove powershell
Conclusion
I hope that now you have a good understanding of How to install PowerShell on Ubuntu 20.04 LTS Focal Fossa.
If anyone does have any questions about what we covered in this guide then feel free to ask in the comment section below and I will do my best to answer those.