Windows PowerShell for UNIX shell addicted person

by on November 14, 2006 · 16 comments· LAST UPDATED December 27, 2007

in , ,

Any seasoned admin will agree that command line is the faster as compare to GUI under Windows and UNIX.

As a part of my job some time I am forced to work in a Windows only environment and I do miss my bash shell very badly :(

Recently Microsoft announced Windows PowerShell. This new shell and scripting language helps IT Professionals achieve greater productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT Professionals to more easily control system administration and accelerate automation :)

=> Supported Operating Systems: Windows Server 2003 Service Pack 1; Windows XP Service Pack 2

=> Download and more information about Windows PowerShell at msdn blog.

=> Complete information and documentation for Windows PowerShell

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 16 comments… read them below or add one }

1 Jonathan November 15, 2006 at 2:44 am

There are two *way* better commandline options for Windows than the “Power Shell”:

1] JPSofts 4NT or TakeCommand. They’re pretty expensive @ US$75 each, but I’ve been using 4NT for a dozen years or more and would be lost without its power. http://www.jpsoft.com

2] Lately though I’ve become a real Cygwin addict. It’s a bit tricky to set up, but it is a very active group and they do a bang-up job of keeping the environment Linux compatible, right down to the latest controversial change where Bash doesn’t like CR/LF, just like on Linux:-) http://www.cygwin.com

Reply

2 nixCraft November 15, 2006 at 2:59 am

Jonathan,

4NT or TakeCommand is new information for me. I was only aware of Cygwin which a quite good choice…

I am downloading 4NT/Take Command 30 days trial. We might end up purchasing few copies :)

Appreciate your post!

Reply

3 Joe November 15, 2006 at 5:12 am

I’ve never heard of those two either, however, from the little I’ve used Powershell, I’ve enjoyed it.

There’s also IronPython which was just released not too long ago. With it, you can access all of .NET, WMI, and even interface with PowerShell through a Python environment.

Reply

4 Dmitry Kalashnikov December 18, 2007 at 4:41 am

Hey guys, I’ve been a UNIX developer for a long time, mainly working on FreeBSD, OpenBSD and Linux platforms.

I am now working at Microsoft, and I do a lot of stuff with powershell. As far as Cygwin or JPSoft stuff being “way better” I’ll have to disagree:

* Powershell is much more powerfull: it doesn’t work on text streams, like unix shells. It (only) works on objects. So input/output pipelines are all .NET objects.

* Powershell, as language is much more expressive then any UNIX shell, period. The closest thing that can match it is Perl 6 or Ruby.

* For Windows scripting, it is the best choice because its specifically made for it. Its tied into Windows (registry, etc).

* It has built-in aliases for most common UNIX commands (ls, cat, ps … etc), so you don’t have to get used to Windows cmd.exe command alternatives. If you just open powershell terminal you should feel right at home!

Check out PowerTab sometime …

-Dmitry

Reply

5 Argyle December 24, 2012 at 5:48 am

Nope. Not even close.

Why should I want to do this:

get-content -tail 5 .\file.txt

When I can do this:

tail file.txt

Powershell is far too wordy. Period. There is no reason, other then typical MS trying to be cool, for this.

Reply

6 john October 18, 2013 at 9:00 pm

I’ve been looking at it, and tried a few commands from command line. Not even close to unix/linux/sun. Maybe if constructing a shell command, there are similarities,
but not having ksh or vi available, and having to type in all that junk, full length words 30 characters long at the command line is absurd to me, especially after having worked with unix for many years. It almost feels like microsoft wants to train a bunch of new programmers in this particular arcane obtuse style, rather than the much more fluid unix style.

Reply

7 Barry Kelly January 15, 2008 at 3:19 pm

A big limitation with PowerShell, though, is job control. The pipes don’t work in a concurrent style. For the kind of scripts I write on my machines (all are at least 2-core, my main desktop 4-core), a careful bit of:


(
echo "Foos and bars:"
(
foo | foo2 | foo3 > foo.out &
bar | bar2 > bar.out &
wait
)
sort foo.out bar.out
) | baz2 | ... &

… etc. works wonders for running times.

Reply

8 Dunpeal November 27, 2008 at 6:25 pm

I tested the new PowerShell which Windows copied from Unix, a lot of things are still missing. It has about 60% of it’s power, but it does not equal to the command line shell of unix. Linux has always been my choice for work, wouldn’t change it for Windows still. Unfortunately a lot of companies use only Windows, it can be a lot of unnecessary drag.

Reply

9 damion lusterman May 7, 2009 at 9:20 pm

“PowerShell which Windows copied from Unix”

thats like saying Unix copied punch cards…or IBM terminals

you need to input things into a computer…a black screen with a promt is the easy way to do it. The features of the UNIX command shell are standard routines a computer should be able to do….

BASH (most popular unix around right now) has less features then windows powershell.

the only main problem is with job control, but they are adding that in with powershell 2.0

Reply

10 Johnny Wang September 7, 2009 at 4:49 pm

Okay, so I want to count the number of commands returned by get-command cmdlet

get-command | WHAT THE FIRK DO I PUT HERE?

in unix it would be: ls /usr/bin | wc -l

in Powershell, you have to know a billion frikking options and dash this and dollar underscore that before you get something simple like commanline.

Microsoft has NEVER thought of commandline as the first class citizen and it still shows. MS people are going gaga over this because they have never felt the power of the unix commandline.

I can have a regular user be productive with a subset of unix shell commands.

in Powershell, either you’re a hotshot VB / .Net programmer (in which case you know the object hierarchy) or you’re screwed!

Tell me how I count th number of commands outputted by get-command?

is this get-command -text output -count ?

nope

is this get-command | get-count?

nope

WTF is it?

Reply

11 fez October 7, 2009 at 5:24 pm

im a linux geek working in a microsoft shop. i’m just learning powershell, but i’ve been blown away by how capable it is. truly amazing. one thing that seems interesting is that powershell appears to have found all my cygwin commands as well. so from right in powershell i can use less, vim, tail, grep….

however for the command count thing i’d go with this:

$commands = get-command
$commands.length

or more concisely how about
$(get-command).length

Reply

12 Richard Berg October 22, 2009 at 5:25 pm

(get-command).length

OR, for more complete processing,

get-command | measure

Reply

13 Ph October 25, 2009 at 8:49 am

(get-command).count

Reply

14 hello kitty March 10, 2010 at 2:07 pm

JohnnyWang: there is one small flaw in your statement – PowerShell was developed by people who have been using Unix command line for like 20 years, it just uses the object-oriented pipeline instead of text-oriented, so you have to start think in objects… it’s like being angry over object C being too complicated after working with Pascal =)

Reply

15 JohnP September 12, 2010 at 9:38 pm

I’m intrigued by PowerShell as a long time Windows user AND a 20+ yr UNIX admin and C/C++ developer. I can see where the “object” pipeline may become more powerful after lots of learning, just like Ruby’s methods are nice AFTER you spend the time learning them. When you have 20+ yrs of shell scripting and aliases have been created to “feel like UNIX/Perl”, I have to wonder. I’m constantly wondering where ‘egrep’ is so I can enter fairly complex regex statements. Don’t get me started on the array notation – what was wrong with the way PERL did it? Being different just to be different is an issue, IMHO.

I’m not looking forward to picking up a script from someone who never learned the UNIX way and wasted all that time typing “Get-Selection” or whatever else Microsoft decided to name some command to make it really-really-really long.

Lastly, I wish they could support CRLF and just CR EOLs. The computer doesn’t care, so why do all the text-based programs on Windows care still?

None of this is meant as a put down towards Powershell – just a few observations.

Reply

16 Akira Shirase June 1, 2011 at 7:04 am

guys, talking about powershell makes this page messy, some opinions creates a big questions to some newbies, which one do i have to use? is it the bash or the powershell?? Well, as far as i’m concern, Being a linux users, i do prefer using the terminal and kick off some works using the bash shells, and well, for those who uses windows platforms who are really tired or putting his/her finger on keyboard to type the bash scripts, they can use powershell to fullfill there needs. its depend on them and the platform that they we’re using. but there is so many thing that the linux terminal can do other than the powershell. and that is the fact.

Reply

Leave a Comment

Previous post:

Next post: