PowerShell is a command-line shell and scripting language that is commonly used on Windows operating systems. However, it can also be installed on Linux systems like Ubuntu. In this blog entry, we will walk through the steps of installing PowerShell on Ubuntu Linux.
Step 1: Add Microsoft package repository To install PowerShell, you need to first add the Microsoft package repository to your Ubuntu system. Run the following commands in the Terminal to add the repository:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/22.04/prod.list
These commands download the Microsoft public key and add the repository to your Ubuntu system.
Step 2: Install PowerShell After adding the Microsoft package repository, you can install PowerShell by running the following command in the Terminal:
sudo apt-get update
sudo apt-get install -y powershell
This command updates the package list and installs PowerShell on your system.
Step 3: Launch PowerShell Once PowerShell is installed, you can launch it by running the following command in the Terminal:
pwsh
This command launches the PowerShell environment, and you can start using PowerShell commands.
Step 4: Verify the Installation You can verify that PowerShell is installed correctly by running the following command in the Terminal:
pwsh --version
This command displays the version of PowerShell that is installed on your system.
In conclusion, installing PowerShell on Ubuntu Linux is a straightforward process. By following these simple steps, you can install and start using PowerShell on your Ubuntu system.