PowerShell is a task automation command-line shell tool and scripting language from microsoft built on .NET framework and the open source version is build on .NET core and called Powershell Core. You can download and install Powershell on Linux, macOS, and Windows operating systems. PowerShell is a very powerful tool .Using this you can manage your computer from CLI easily.
Install PowerShell Core on Ubuntu:
You can install PowerShell on Ubuntu 18.10 and later easily via snap packages. For older versions of Ubuntu, you can install it via deb package file.
Install PowerShell vai Snap:
Open your terminal app and type the below command and hit enter.
sudo snap install powershell --classic
Type your Ubuntu password. It will install the latest stable version of PowerShell on Ubuntu.After the successful installation of PowerShell, click the show applications in the Ubuntu Gnome dock and type PowerShell in the search box and click PowerShell to open it. For Unity you can search PowerShell from Ubuntu dash.
For the development versions of PowerShell, you can try below snap commands in terminal.
PowerShell release candidate:
sudo snap install powershell --candidate --classic
PowerShell Beta:
sudo snap install powershell --beta --classic
PowerShell edge:
sudo snap install powershell --edge --classic
Install PowerShell via deb package file: [For Ubuntu 16.04 and Ubuntu 18.04 only]
Download PowerShell deb package file:
Download the latest PowerShell .deb file based on your Ubuntu version from above download link. After that, install the downloaded deb package file with your favorite package installer. currently i am using GDebi Package Installer to install PowerShell. If you don’t have GDebi Package Installer just install it with the below command in your terminal app.
sudo apt install gdebi
Or you can also install GDebi Package Installer from Ubuntu software center.
Right click on the downloaded PowerShell .deb file (Here its: powershell_6.2.3-1.ubuntu.18.04_amd64.deb) and select open with other software and choose GDebi Package Installer. Then click install Package. It will install Powershell on your ubuntu system. That’s all.
You can also install powershell via below commands in terminal.
sudo apt-get update
cd Downloads
Here Downloads is my default download folder
sudo dpkg -i powershell_6.2.3-1.ubuntu.18.04_amd64.deb
your change based on your poershell version and ubuntu version or your downloaded file.
sudo apt-get install -f