How to Install PowerShell Core in Ubuntu Linux

When Microsoft released PowerShell in 2011 for the very first time, it was intended to be a future replacement for the aging “cmd.exe” shell that has stayed with Windows since the beginning. But in 2016 Microsoft made PowerShell Core open-source and cross-platform so that it can be used on all the popular operating systems including Linux and Mac OS. PowerShell Core, being open-source, can now be customized by open-source developers. And of course, if you have dual boot system with Windows and Ubutnu Linux, then you can use your PowerShell scripts in both of the operating systems.

PowerShell Core can be easily installed in Ubuntu Linux in the following way:

  1. Download PowerShell installation package from https://github.com/PowerShell/PowerShell/. The downloads are available in the DEB package formats for all the recent versions of Ubuntu Linux. These same packages can also be installed in Ubuntu variants such as Lubuntu or Kubuntu etc.
  2. Double-click on the downloaded DEB package file and click on the Install Package button.Install PowerShell Core in Ubuntu Linux
  3. After you have supplied the user credentials, it will begin to install files in your system. The progress will be displayed and after a few seconds, you will be shown the message that the package was successfully installed.Install PowerShell Core in Ubuntu Linux
  4. Once the installation is done, you can close the Package Installer window. In order to check PowerShell, open Terminal window by pressing Ctrl+T and type pwsh in the Terminal.Install PowerShell Core in Ubuntu Linux

In order to check the version of PowerShell, you can type $PSVersionTable in the PowerShell console. In the information that is displayed, PSVersion should show the PowerShell version (at this moment the latest stable version is 6.1.0), PSEdition should show Core and of course, the Platform would be displayed as UNIX.

You can use the same steps for installing PowerShell Core in all the supported variants of Linux including Ubuntu, Debian, CentOS, RedHat, OpenSuse, Fedora and Kali Linux.