UNIX on Windows (Microsoft’s little secret)

March 16th, 2010

For many years now, Microsoft has had a technology that allows you to run UNIX commands within Windows. More importantly it provides an easy-ish way to port UNIX programs onto Windows. I say easy-ish because it’s not without its issues and it’s not safe to assume that something you built for Solaris or RedHat Linux will run on this Windows subsystem without further work. This means thorough testing becomes a must if you develop for UNIX and deploy on Windows.

The name of this technology? It used to be called Interix, then became Services for UNIX (SFU) as they added more bits on top of Interix, and is now known as Subsystem for UNIX-based Applications (SUA). The current name is more of a mouthful, but is a more accurate name.

Microsoft don’t advertise SUA. Some of us have been using it, and its predecessors, for years. But, on the whole, it’s a pretty well kept little secret. And, not surprisingly, it’s only available on the server versions of Windows, or the desktop versions aimed at business users and IT professionals.

So, to run SUA, you need one of the following versions of Windows:

  • Windows Server 2008
  • Windows Server 2003 R2
  • Windows 7 – Enterprise or Ultimate Edition
  • Windows Vista – Enterprise or Ultimate Edition
          

To enable and install SUA:

  1. Go to the Control Panel.
  2. Click Programs and Features.
  3. Click Turn Windows features on or off in the left panel.
  4. Select the check box for Subsystem for UNIX-based Applications.

    SUA-enable

  5. Click OK.
  6. In the start menu, click All Programs > Subsystem for UNIX-based Applications > Download Utilities for Subsystem for UNIX-based Applications.

    SUA-download

  7. Download the SUA installer from the Microsoft website.
  8. Once downloaded, double-click Utilities and SDK for UNIX-based Applications_X86.exe in your downloads folder.
  9. Step through the auto-installer.

    I’d recommend you choose the custom setup and enable the GNU Utilities and then, in the following step, select all three check boxes to allow su to root, enable setuid and enable case sensitivity.

      
Now, you can go back to the Subsystem for UNIX-based Applications start menu item and launch a Korn shell or a C shell and, within that shell, run UNIX commands:

 SUA-shell2

I know a lot of developers who don’t like SUA, but personally I’ve always liked it. It’s really handy sometimes to have UNIX commands available within Windows, and it’s a great way to familiarise yourself with UNIX tools like vi.

An important resource for SUA users is the SUA Tool Warehouse:
http://www.suacommunity.com/tool_warehouse.htm

Potentially similar posts