Scott Hanselman

Announcing PowerShell on Linux - PowerShell is Open Source!

August 18, 2016 Comment on this post [28] Posted in Open Source | PowerShell
Sponsored By

I started doing PowerShell almost 10 years ago. Check out this video from 2007 of me learning about PowerShell from Jeffrey Snover! I worked in PowerShell for many years and blogged extensively,  ultimately using PowerShell to script the automation and creation of a number of large systems in Retail Online Banks around the world.

Fast forward to today and Microsoft is announcing PowerShell on Linux powered by .NET Core and it's all open source and hosted at http://GitHub.com/PowerShell/PowerShell.

Holy crap PowerShell on Linux

Jeffrey Snover predicted internally in 2014 that PowerShell would eventually be open sourced but it was the advent of .NET Core and getting .NET Core working on multiple Linux distros that kickstarted the process. If you were paying attention it's possible you could have predicted this move yourself. Parts of PowerShell have been showing up as open source:

Get PowerShell everywhere

Ok, but where do you GET IT? http://microsoft.com/powershell is the homepage for PowerShell and everything can be found starting from there.

The PowerShell open source project is at https://github.com/PowerShell/PowerShell and there are alphas for Ubuntu 14.04/16.04, CentOS 7.1, and Mac OS X 10.11.

To be clear, I'm told this is are alpha quality builds as work continues with community support. An official Microsoft-supported "release" will come sometime later.

What's Possible?

This is my opinion and somewhat educated speculation, but it seems to me that they want to make it so you can manage anything from anywhere. Maybe you're a Unix person who has some Windows machines (either local or in Azure) that you need to manage. You can use PowerShell from Linux to do that. Maybe you've got some bash scripts at your company AND some PowerShell scripts. Use them both, interchangeably.

If you know PowerShell, you'll be able to use those skills on Linux as well. If you manage a hybrid environment, PowerShell isn't a replacement for bash but rather another tool in your toolkit. There are lots of shells (not just bash, zsh, but also ruby, python, etc) in the *nix world so PowerShell will be in excellent company.

PowerShell on Windows

Related Links

Be sure to check out the coverage from around the web and lots of blog posts from different perspectives!

Have fun! This open source thing is kind of catching on at Microsoft isn't it?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
August 18, 2016 19:24
you need more coffee scott. 2016-2007 is 9, not 14.
powershell first appeared November 14, 2006; 9 years ago according to wikipedia. https://en.wikipedia.org/wiki/Windows_PowerShell
August 18, 2016 19:26
The link to the github repo is incorrect. It should read github.com/Powershell/Powershell.
August 18, 2016 19:31
Jeremy - Oops! Thanks
Gridaran - Fixed!
August 18, 2016 20:18
Wow this is awesome!!
Nmk
August 18, 2016 20:40
Although this is cool, i'm trying to understand why would anyone use powershell over existing shell utilities.

Maybe for cross compatibility sake ?
August 18, 2016 21:11
@Carlos, I initially thought that until I read the part about managing remote Windows machines.
August 18, 2016 21:13
This is kinda stupid. What is the point when I can use standards that already exist on Linux. Powershell is a pain to deal with.
August 18, 2016 21:38
Bash on Windows, Powershell on Linux... The next logical step would be to port an open source command.com (from MSDOS 3.2) to iOS. When ?
August 18, 2016 22:09
@Carlos Ferreira, it's useful on DevOps escenarios... specially with the .NET Core stuff.
August 18, 2016 23:09
Powershell in Docker :)

https://hub.docker.com/r/manojlds/powershell/
August 18, 2016 23:15
Thanks great step towards popularity of .net and PS! Hope it will boost plugins/modules development
August 19, 2016 0:05
This is great news! Up until now, cross platform .Net projects, like Dotnet CLI itself, used separate build scripts for Linux and Windows. Now, it will be possible to write one PowerShell script to rule them all. I personally have tons of build/deploy/other DevOps scripts written in PowerShell (and DSC). I would rather gladly test them on Linux and work around the rough edges than rewrite all that stuff in Bash (and maintain two separate versions). If someone thinks of dockerizing his services, the possibility to use the same scripts on Linux and Windows should make the transition much smoother.

But the most important thing here for me is open sourcing Powershell. If Microsoft didn't prepare a version that runs on Linux, someone other geek would probably do it sooner or later (it's worth mentioning that there already exists an open source effort to reimplement Powershell: Pash.
August 19, 2016 0:20
Is this to support SQL Server on linux?
August 19, 2016 0:32
What made you think that Linux users need it? What is so special about it?
August 19, 2016 0:54
Once again this is what I called 'geeks trap theory' Imagine your self writing down some libraries to extend that open sourced version then we suppose that what you authored is valuable as an investment then the question will be who will benefit of the fruits of that effort? Microsoft or that geek?




August 19, 2016 1:06
@Haafiz PowerShell is very different from traditional shells in that the language treats everything as objects rather than just text. This reduces the need for tools like awk, sed and grep. In most *nix shells, you pipe text from one command to the next. In PowerShell, you are piping rich objects from one command to the next and you only turn the object into text when you need to display it or when you want to save it to a file (of course you could save it as binary data as well). Of course, you don't have to use PowerShell, and many *nix users will happily ignore it, but those of use who are familiar with PowerShell and who work on *nix machines will happily incorporate it into our toolsets.
August 19, 2016 1:10
@csharp.geek As an open source advocate, why would I care who benefits from the fruits of my efforts? I have certainly benefited from a lot of Open Source work that MS has participated in, and I have no problem with them benefiting from some of my work in return.
August 19, 2016 3:47
Is this a good way of using NuGet on OS X? Lots of documentation on NuGet packages seems to assume that you're using Windows and the VS Package Manager Console, so I was looking forward to being able to follow these sorts of examples in a straightforward manner when developing for ASP.Net on OSX (example: adding a package to my project through the command line, like "Install-Package <Package-Name>)

Here's what I did, hoping it would work...
--Installed PowerShell using .pkg installer on OS X
--Opened a terminal and entered "powershel"
--Typed "Install-Package -ListAvailable", which was suggested as something you could do with the Package Manager Console here: https://docs.nuget.org/consume/package-manager-console
--Got this error:
Get-Package : A parameter cannot be found that matches parameter name 'ListAvailable'.

So it looks like the Get-Package command is something that PowerShell recognizes, but it doesn't behave the same way as it does in the VS Package Manager Console?

Is this something I can eventually expect to work? Is there something obvious I'm overlooking about how to make it work?
August 19, 2016 5:22
One other reason for this is so that you can more easily manage Azure resources from Linux. For instance, to spin up a new Linux VM on Linux, you can do so with PowerShell on Linux.
August 19, 2016 13:37
This is seriously exciting for me, as i run a large number of windows and linux VM's all backed off of hyper-v at the edge and azure so this is brilliant :) Along with SQL Server on linux this has made my year.
And as open SSH is getting native support in powershell too i truly can have one shell to rule them all. With a bit of thought i should be able to unify my bash and ps library into a single set of CmdLets which can then be automated via systems centre etc..

Some of the things that Scott hasnt mentioned here are the PS Linux CmdLets things like to add a new cron job, rather than firing up vi/vim/emacs/nano and counting comma's then finding you have a syntax error after all the cmdlet wraps it all up for you, yes i can do that in bash, but if i can just invoke the command via ssh from my desktop that will be a real time saver along with tab completing the command. While bash is great and all, for me its much like Java circa 2000 its showing its age, there are too many ways of doing the same thing, and what started with good ideals has degenerated into who can do the most operations with the most convoluted {[]}{()} syntax going, besides as its linux you can run what ever shell you like, just happen to like powershell the most at the moment :)

Now if only the default windows powershell CLI was tabbed like SuperPutty....
August 19, 2016 15:31
@Andrew Stegmaier

PowerShell nuget package manager (the one from Visual Studio) has cmdlet's name collisions with PowerShellGet (PS package manager), which you run in PowerShell on OS X. They essentially provide the same functionality for different scopes (project vs the whole system), but available parameters are different. It's indeed confusing, we are sorry.

PowerShell project uses github issues. Please, feel free to open new issues on https://github.com/PowerShell/PowerShell/issues and ask any questions or propositions. It's the best place for such discussions.
We are very much appreciate feedback!

-Sergei
PowerShell team
August 19, 2016 19:11
Are they making something called Winux? Not sure this is important
August 19, 2016 20:11
@Sergei

Thanks for the response! I'll check out the GitHub repo and continue the conversation there.
August 20, 2016 4:10
Is there any documentation available yet on porting binary Windows Powershell Modules to Linux?
Rob
August 20, 2016 10:55
Took me a while to figure out that I needed to enter "powershell" in the terminal emulator to invoke the powershell shell.
August 22, 2016 18:11
Nice article Scott,

Do you have any idea how we will get a grasp on system information?

Also, I have summarized everything that has been said, the various blog posts etc.. and regularly update the page with all the Powershell open source information here --> http://powershelldistrict.com/powershell-linux/
September 06, 2016 9:58
I really wonder if this will enable cross system compatibility between Linux and Windows. The existing Bash is more advanced in Linux. Of course the recent bash shell to Windows also strikes me sometimes that there is really some change that is going to happen :) :)
September 08, 2016 14:06
Cool !

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.