How to Install PowerShell in Linux?
Last Updated :
06 Oct, 2021
PowerShell is well-known among Windows administrators. It is a.NET-based task-based command-line shell and scripting language. You can quickly automate tasks for operating system maintenance and much more with PowerShell. PowerShell was once only available for Microsoft Windows. This admin tool, on the other hand, can now be installed and used on Linux.
Installing PowerShell using Snap packages
1. The least complex approach to install PowerShell using snap is as per the following :
sudo snap install powershell --classic
Installing PowerShell using snap
2. Now you can simply launch PowerShell by using a simple command :
pwsh
Opening PowerShellInstalling PowerShell using a package repository
Installing PowerShell from a package repository is the preferred approach in Linux.
1. First update list of system packages using below command :
sudo apt-get update
Update system source
2. Install pre-requisite packages using the below command :
sudo apt-get install -y wget apt-transport-https software-properties-common
Installing pre-requisite packages
3. Now download the Microsoft repository GPG keys :
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
Downloading Microsoft GPG key
4. Then register the Microsoft repository GPG keys :
sudo dpkg -i packages-microsoft-prod.deb
Registering GPG key
5. Then update the system source :
sudo apt-get update
Updating system source
6. Enabling the universe repositories :
sudo add-apt-repository universe
Enable universe repositories
7. Now we can finally install PowerShell using the below command :
sudo apt-get install -y powershell
Installing PowerShell
8. Now we can start PowerShell by simply typing the below command :
$ pwsh
Starting PowerShell
Similar Reads
How to Install Perl on Linux? Prerequisite: Introduction to Perl Before, we start with the process of Installing Perl on our System. We must have first-hand knowledge of What the Perl Language is and what it actually does?. Perl is a general-purpose, high level interpreted and dynamic programming language. Perl was originally de
3 min read
How to Install Z Shell(zsh) on Linux? The ZSH or Z Shell is a Unix based shell or can be called as a command-line interpreter. It is an extended version of the good old Bourne shell (sh). It does have some features form Bash with lots of added features like automatic cd (Change Directory), spell check, path expansion, and many more. It
2 min read
How To Install Poweriso On Kali Linux PowerISO is a flexible and extensively used marketable software designed for managing, creating, editing, and burning ISO image lines. PowerISO provides a range of essential features for working with these lines, making it a precious tool for both Windows and, with the help of comity layers like Win
4 min read
How to Install GNU Octave in Linux? Octave is open-source, free available for many of the platforms. It is actually a High-level Language. It comes up with a text interface along with an experimental graphical interface. It is also used for various Machine Learning algorithms for solving various numeric problems. You can say that it i
2 min read
How to Install PHP on Linux? PHP is a popular server-side scripting language that is especially used in web development. If you're working on a Linux environment, whether it's a personal development setup or a production server, you will likely need PHP installed. In this article, we will see the step-by-step guide to install P
2 min read