Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell eye for the Bash guy

For someone who has been using bash for years, what's the quickest way to get productive with Microsoft's PowerShell? I've noticed my old friends ls and ps work, but sadly grep didn't. I could just man up and read through the piles of documentation, but I'm guessing there is a quicker path to productivity for someone with a long history of bash usage.

I don't know if it matters or not, but the reason I'm looking to get acquainted is because it seems like there is finally a proper shell on Windows instead of needing to install cygwin, and I'd like to start using it exclusively instead of writing bat files for automated activities like builds and deployments and such.

like image 296
slf Avatar asked Oct 19 '09 22:10

slf


2 Answers

I'm not sure your Bash history is going to help you much with PowerShell. It is quite a bit different since the idea is to pipeline rich .NET objects as opposed to text or byte streams. For a leg up, check out my Effective PowerShell free eBook. It is about 60 pages but I think does a decent job of outlining the mental model you need to get the most out of PowerShell. For a full, free book check out Master PowerShell. At the point you think you're willing to part with some $$, Windows PowerShell in Action is the best book out there IMO.

Note: there are some "Unix" oriented aliases to get you by for a while (ls, ps, etc) but you'll run out of steam pretty quick because the parameters are quite different and as I said the pipeline is quite different than in Bash.

I would also recommended looking over some of the Q&A on PowerShell on StackOverflow especially for those questions that you think - "yeah, how would you do that in PowerShell". I think you would learn a good bit just doing that.

like image 190
Keith Hill Avatar answered Nov 15 '22 21:11

Keith Hill


A quick Cheat sheet

like image 29
mjv Avatar answered Nov 15 '22 20:11

mjv