Install PowerShell Core 6.1 on Ubuntu Linux 18.04.1

In this blog post, I will show you how I install PowerShell Core on Ubuntu Linux and run PowerShell cmdlets on Linux.

PowerShell

It has been almost two years since Microsoft announced the PowerShell is becoming open source and cross-platform tool.

With PowerShell Core, there are no boundaries to where you can run it and use since it is an open source tool.

Get Started

In my case, I have a Ubuntu Linux virtual machine running on Microsoft Azure and I will go ahead and install PowerShell on it.

The first command I will start with will be wget which will download the latest PowerShell version to my VM.

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

Next, I will extract the package using the line below

sudo dpkg -i packages-microsoft-prod.deb

Before I install PowerShell, I will update all application that is installed on the VM

sudo apt-get update

 To install PowerShell, I will run the command below

sudo apt-get install -y powershell

Now, I can go ahead and start PowerShell using the command below

pwsh

As you can see below, I am running PowerShell Core 6.1.1 and I am ready to start using PowerShell on Linux

One of the great things about Linux that you can use autocomplete when typing a command and below you can see that when I type get- and press the Tab key on the keyboard all the get cmdlets are showing up.

get-

And I can simply run any command and see the output

get-uptime

Update PowerShell

To update or check for updates I need to use the command below which will search for updates and install new ones.

sudo apt-get upgrade powershell

Conclusion

I have to say that running PowerShell in Linux helps me a lot to get around Linux, however, every now and then I still need to use my Linux command line guide I published 5 years ago.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.