Installing PowerShell Core on Linux via Public Repository

Yeah, you read right. I am now writing about Linux ;-). But only for this blog post. PowerShell Core 6.0 is a cross-platform tool, so I decided to write a small guide how to install PowerShell 6.0 Core on a Linux system.

For this task I am going to use Ubuntu 16.04.

Installation of PowerShell Core via Online Repository

This is the recommended method. PowerShell Core is published to repositories.

Import public keys

Firstly, we import the public repository keys.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -


Register Microsoft Repository

Then we have to register the Microsoft Ubuntu repository. Take care of the URL. As said, I’m using Ubuntu 16.04, so I have to provide this version in the URL. You’ll have to adjust that.

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list


Update list

Next we update the list of products.

sudo apt-get update

Installing PowerShell Core 6.0 on Linux

Now comes the exciting moment: Welcome PowerShell 6.0 on Linux!

sudo apt-get install -y powershell


Other installation methods can be found here:


First Steps

Enter pwsh. Welcome to PowerShell on Linux!



Doing some basic tasks …

Get-ChildItem /etc




A few more demanding things…

Get-Process | Select-Object ProcessName,Id




New-Item -ItemType file -Name patrick.txt


Testing brackets and Foreach-Object …

1..10 | Foreach-Object {New-Item -ItemType file -Name file$_.txt}


That’s it for now. Have fun with PowerShell Core on Linux!

Categories: PowerShell

Tagged as: ,

2 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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