Is Windows PowerShell as powerful and efficient as Linux' terminal?

People offline tell me, without explaining much, that Windows PowerShell is an attempt to make Unix administrators feel more comfortable using Windows. But I guess, they will be comfortable only if it has (or almost) same efficiency.

  • 3
    That's hard to answer, because there is not THAT Linux shell. There are many shells commonly used on Linux (or generally *nix systems). The most used one is bash, so you may want to ask about that.<br> Also "powerful" is very opinion based. – Kritzefitz Jan 26 '14 at 17:02
  • 8
    People offline tell me ... that Windows Powershell is an attempt to make UNIX administrators feel more comfortable using Windows. Those people have neither used Unix or Powershell. – surfasb Jan 26 '14 at 17:23
  • I'd say that PowerShell is an acknowledgement from some areas of Microsoft that they messed up by not having a powerful shell available. It does not at all copy the style of UNIX however. To know PS, you really do well to understand a bit about how Windows works and how .NET works. – Julian Knight Jan 26 '14 at 18:08
  • BTW, Microsoft did have a BASH shell available that was part of a migration toolkit supposed to help people move from UNIX to Windows Server. – Julian Knight Jan 26 '14 at 18:09
  • 1
    I am a longtime Unix fanboy who prefers Unix to Windows in most respects; however, PowerShell beats bash hands down because one pipes objects having key/value pairs and not pure text. This makes it more similar in design to jQuery than to bash. – Mario Dec 19 '14 at 17:11

Well, your first problem is that you are comparing a shell (PowerShell) to a terminal. In Linux, a terminal is something that sends and receives character-based I/O and is assumed to have an interactive user behind it (in other words, it's the GUI application used to contain a shell). One of the most common shells run within Ubuntu's Terminal is Bash, but there are others.

People offline tell me, without explaining much, that Windows PowerShell is an attempt to make Unix administrators feel more comfortable using Windows.

Really, the correct thing to say is that PowerShell is Windows exposing much of the WMI, COM and .NET object model in an interactive and scriptable command line environment - and that this command line environment continues to borrow many of the concepts - such as pipelines and I/O redirection - from Unix shells, just like the old DOS (2.0 and up) command.com and cmd.exe did. Pipelines work with objects in PowerShell. You can do things like create HTML and possibly Excel spreadsheets on the fly if you knew enough. It's certainly an upgrade/replacement from the old cmd.exe shell which hasn't changed much from Windows NT 4.0.

Regarding the syntax, it's less like the Unix shells (although finally none of the cmdlets use / as a switch or parameter indicator), but there are many aliases to classic Unix commands - such as entering ls in a PowerShell window will work like dir. But these are just aliases ("Get-Alias" lists these?).

Regarding the capability of PowerShell, you really had similar capability, in a scripted-only fashion, from VBScript and CScript - though both of these predate .NET.

One thing Unix people do not have to do when using Bash most of the time is to be intimately familiar with a programmer's or object's possibly very elaborate object model, which is required for many advanced and simple PowerShell tasks. But this is only possible because there is a clear convention of straight text output for many standard POSIX commands. Windows has not had this tradition - it has seemed to prefer you use an mmc console for adminstration tasks, with commands added here and there over the years. Furthermore, many well-known Unix utilities are complex and require some study before use - rsync, wget, and many others. Efficiency is probably a function of how well one knows the tool they are using more than anything else.

| improve this answer | |
  • 8
    +1 for mentioning that PowerShell exposes .NET to the console & as a scripting host. It exposes the power of many key Windows libraries to be used in scripting. The use cases between the two may be similar, the style is totally different. – Julian Knight Jan 26 '14 at 18:06
  • 3
    +1 for mentioning that a terminal contains a shell. I've used Windows and Linux for a long time but never had anyone state the difference so clearly. – Tyler Collier Sep 8 '14 at 21:23

Windows PowerShell and Unix shell are two different things with advantages in both.

Unix (shell) has a philosophy that everything is a file. The input and output of a Unix command can be accessed like a file. This makes chaining command really simple and reusing the output of one command by another is the power of the Unix shell.

With Windows PowerShell, as far as I know, everything is an object. You can pass the result of a command to another as an object. This can be really powerful, but it does not have the simple concept of Unix.

I don't believe that PowerShell is as efficient as a Unix shell, but others believe that it is.

But the comparison is moot, because Windows is not a *nix system, thus *nix concepts don't apply. Compared to MS-DOS, PowerShell is a great improvement.

| improve this answer | |
  • 5
    The everything is a file has nothing to do with the shell, it is a kernel thing. – terdon Jan 26 '14 at 17:31
  • 4
    True, but it impacts on how the unix shell is designed. – Biapy Jan 26 '14 at 17:38
  • @terdon: That's right, but the shell works nicely with this. Because it's still the shell that recognizes symbols like |, < or >. – Kritzefitz Jan 26 '14 at 17:39
  • 1
    People keep talking about these objects in powershell. Being used to cmd.exe and bash (or other shells) only, can you elaborate, perhaps with a simple example? – Luc Oct 31 '14 at 11:04
  • 8
    Without sending you away from this page - when you pipeline things in *nix systems on the right side of the pipe you expect simple text, for example --- history | grep cp --- will return only lines that contain cp. On the other hand when pipelining things in PS on the right side you get an object, with properties, like this --- Get-History | Where-Object {$_.CommandLine -eq "cp"} --- $_ is each object, CommandLine is the property, -eq is equal to and finally the string cp. – Unknown Oct 31 '16 at 20:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.