A cold day indeed: BASH runs on Ubuntu running on Windows 10

JC Torres - Mar 30, 2016, 9:45 pm CDT
4
A cold day indeed: BASH runs on Ubuntu running on Windows 10

We already saw the telltale signs, but you might still do a double take when you hear the official word. Microsoft and Ubuntu creator and owner Canonical have indeed made it possible to run Linux user space commands on an image of Ubuntu running on Windows 10 natively. No virtual machines, no containers, no dockers. While that might mean little to anyone except for developers, power users, and Linux users, it does open the door to possibilities but also raises some questions on Microsoft’s real goal.

For years, it has been possible to actually run such Linux commands on Windows through a variety of methods. You can, for example, run a full blown Linux installation inside a virtual machine. While that allows you to get the full unencumbered power of Linux, more or less, it does have some drawbacks. For one, you are chugging up system resources like there’s no tomorrow. And virtual machines are like islands unto themselves, with very minimal support for accessing files outside it or for the host/external computer to access files inside the virtual machine.

On the other hand, there are also tools like Cygwin and MSYS that do let your run certain Linux commands natively to some extent, but what those do is to take the open source code for these utilities and programs and recompile them for Windows. And the set of commands are also somewhat limited in comparison.

What Canonical and Microsoft have pulled off is different and perhaps interesting from a software engineering perspective. It doesn’t use recompiled programs but the exactly identical, bit by bit, Linux programs to run on Windows. The two developed a sort of compatibility layer that translates Linux system calls into Windows ones. Linux users familiar with the WINE project will see similarities here, except it works in reverse.

The end result is that users will be able to run popular commands like find, grep, awk, sed, and the whole bunch of BASH utilities right on Windows. Even the APT command, which is used for managing software on Ubuntu, actually works. It doesn’t stop there, however. Even Linux version of Python and Ruby, for example, will run with no problems on Windows, no need to hunt for the Windows versions. Consequently, scripts written for those will also run on Windows 10. Perhaps even more magical is that users can access files from either end of the communication line. The Linux command line can access Windows files from a familiar “/mnt/c/” directory while Windows Explorer can also look at the Linux files from somewhere in the user’s directory.

bash

These tools are meant to ease the transition of Linux and open source developers into using Windows 10 as a development platform, which is ultimately a net win for Microsoft. The integration is, of course, limited and user’s shouldn’t expect the full power of Linux to be available. But it might not take too long before those same power users and developers take this feature beyond its intended objectives.

Check out our Microsoft Hub to see the rest of our BUILD 2016 coverage.

SOURCE: Windows, Dustin Kirkland


Must Read Bits & Bytes