PowerShell comes with the Windows operating system and is usually pre-installed. However, if you want to use the latest version or install PowerShell on a Linux or macOS operating system, you can follow the steps below.
If you think, you need more details about using PowerShell, you can use our PowerShell Introduction course.
Besides Windows, PowerShell is also available for Debian, Ubuntu, CentOS, Fedora, openSUSE and many more Linux distributions. Below are the installation steps for Ubuntu:
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/20.04/prod.list
sudo apt-get update
sudo apt-get install -y powershell
In the first two lines, we add the Microsoft repo and package key to our system.
In line 3, we update the package database in our system so that our system is aware of the repo we just added.
And finally, we install the PowerShell packages.
Once the installation is complete, simply type the “pwsh” command in the terminal to start a new PowerShell session.