Is Windows PowerShell as powerful as the terminal of Unix/Linux? [closed]
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.
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.