Tuesday, August 30

Shell Game

A lot of us spend a lot of time switching between Windows and Linux. Now that platforms like the Raspberry Pi are popular, that number is probably increasing every day. While I run Linux on nearly everything I own (with the exception of a laptop), my work computers mostly run Windows. The laptop is on Windows, too, because I got tired of trying to get all the fancy rotation sensors and pen features working properly under Linux.

What I hate most about Windows is how hard is it to see what’s going on under the hood. My HP laptop works with a cheap Dell active stylus. Sort of. It is great except around the screen edges where it goes wild. Calibration never works. On Linux, I could drill down to the lowest levels of the OS if I were so inclined. With Windows, it is just tough.

War is Shell

One place where Linux always used to have an advantage over DOS and Windows was the shell. There are lots of variations available under Linux, but bash seems to be the current pick for most people. If you want more power, you can move to some alternatives, but even bash is pretty powerful if you learn how to use it and have the right external programs (if you don’t believe it, check out this web server).

In the old DOS days, some of us went to 4DOS which was nice, but no bash (and apparently morphed into the Windows Take Command Console software. I’ve seen a few people use things like Rexx as a shell under DOS or Windows, but it has always been a small minority.

Windows Power

Microsoft finally addressed the shortcomings of its default command interpreter, first introducing Windows Scripting Host to allow Javascript and VBScript batch files. Eventually, this was supplanted by Monad which later became known as the Windows PowerShell.

In addition to running programs, the PowerShell can use functions and cmdlets (programs made to interact with the shell). While it isn’t compatible with a traditional Linux shell, it has similar powers and many people–especially system administrators–make heavy use of it to automate tasks.

Shell Shock

Two things have recently happened that surprised me. First, Microsoft made bash available (and other Linux executables) for Windows 10 as a native application (you can find the detailed install directions online). The surprise isn’t that this is possible. I’ve used Cygwin and UWIN to have a very full-featured Linux environment under Windows for years (and did the same with MKS under DOS). The surprise was that Microsoft would “cross the streams” and officially support a Linux/Unix tool on Windows. Sure, NT used to have a crippled POSIX subsystem, but it wasn’t practical. This appears to be a genuine attempt to put the shell on Windows (which, again, is only remarkable because it is Microsoft doing it).

The second piece of news that surprised me is that you can now get PowerShell for Linux or OS/X. I’m not sure how many Linux users will rush out for a .NET tool, but it is one more way to make the systems more alike which is nice when you use both.

Decisions, Decisions…

So now you have several options for using Linux and Windows without going crazy switching between the two:

  • Run Linux and put Windows in a virtual machine
  • Run Windows and put Linux in a virtual machine
  • Use bash everywhere (using Cygwin or the Microsoft product)
  • Use PowerShell everywhere

If you just can’t stand to take software from Microsoft, you could check out PASH, which is essentially a rewrite of PowerShell using Mono. I’m not sure how much momentum it will retain now that Microsoft is supporting something so similar.

If you do want to learn more about PowerShell, the Wikipedia article on it has a nice table that relates PowerShell to cmd.exe to Linux shell. There’s also a video, you can watch below.

Thanks to [rogeorge] for the tip about PowerShell.


Filed under: Hackaday Columns, rants

No comments:

Post a Comment