Bash on Windows: What Does It Mean?

20316

As the enterprise landscape is changing — in favor of Linux and open source — companies like Microsoft are embracing Linux. Most recently, Microsoft announced support for the Unix Bash shell on Windows, providing developers and administrators with an important tool for managing Unix and Linux servers.

Linux is a dominant player in the enterprise space. Microsoft says that more than 25 percent of machines on Azure Cloud run Linux. This means there’s a huge developer base along with a huge administrator base that manages these machines. And, these people need tools to manage their infrastructure.

Microsoft is aware of this increasing demand, and they have tried to bring some basic capabilities like SSH to their PowerShell, but it’s not enough. Developers can also use Cygwin, MSYS, or run Linux in a virtual machine, but all these “workarounds” have their own disadvantages and some serious overload.

Virtual machines, for example, are complete operating systems in themselves, they need dedicated processing power, memory and storage. That’s not an ideal solution for developers working from their laptops, as system resources are shared between host and guest operating systems that slows the entire machine down.

What Is It?

Bash on Windows is Microsoft’s solution to the problem and it aims to bring the entire Ubuntu userland, minus the Linux kernel to Windows. As a result, developers have access to the complete set of Ubuntu CLI tools and utilities. In layman’s terms, it’s akin to running Linux in Windows, natively.

Dustin Kirkland of Canonical explained to me in an email, “VMs and dual booting may well still have a place. But think about the way a Mac desktop user uses the command line… vi, grep, sed, awk, find, ssh — all at your fingertips in a native shell on Mac (or Linux). That’s never really been a first class experience with a Windows desktop. Sure, you’ve always had Cygwin and virtual machines. But that’s not the same as editing local files, on the local hard drive, etc.”

The bottom line is that developers need tools that work natively, the same way they work on a Mac OS X or Linux desktop. As a Microsoft spokesperson told me, “We have built a new infrastructure within Windows — the Windows Subsystem for Linux (WSL) — upon which we run a genuine Ubuntu user-mode image provided by Canonical, creators of Ubuntu Linux.”

The clear benefit here is that Microsoft brings “native” Linux capabilities to Windows. Now developers don’t need to make compromises like VM or Cygwin. Now developers get an uncompromised Linux experience on top of Windows. Because it’s natively integrated, developers can work on the same file from either Windows tools or or Ubuntu tools.  

How It Works

Canonical and Microsoft have worked together on this project since January of 2016, Kirkland said. Through WSL, developers can now run Ubuntu userland on top of a Windows kernel. It’s the same Ubuntu minus the Linux kernel. 

“Using this new subsystem, we can run many of Ubuntu binaries used by developers, including the common shells and commands, such as the Ubuntu Bash shell. Developers can now run Bash scripts, Linux command-line tools like sed, awk, grep, and Linux-first tools like Ruby, Git, Python, etc. directly on Windows,” said the Microsoft spokesperson.

That means, when you open the Bash shell in Windows, you are literally running Ubuntu so you can apt-get install any command-line application that’s available for Ubuntu. As a result, every single Ubuntu command-line application is now available at your disposal. You are able to use all Linux tools such as ssh, wget, and more. You can use all Linux commands, such as rsync, which otherwise don’t work on Windows.  

When asked about the level of technical collaboration between Microsoft and Ubuntu, Kirkland said, “Our mutual goal with Microsoft is to see really complete, perfect coverage of the LTP and stress-ng functional tests, ensuring that the entire Linux syscall space is well covered. We’ll also want to ensure that early adopters can dist-upgrade their Ubuntu 14.04 environments seamlessly to Ubuntu 16.04 in a few weeks. And we’ll be replacing the Ubuntu 14.04 image in the Windows store with Ubuntu 16.04 soon, such that the default experience will be Ubuntu 16.04 LTS — literally the latest and greatest of all open source software in the world.” 

Who Is It for?

Developers. Developers. Developers. Period.

The whole idea of running Ubuntu Bash shell on Windows is to allow developers to run Linux tools natively on Windows. “Ubuntu on Windows” will eliminate the need for dual booting with Ubuntu on your system just to run those tools. It eliminates the need of exclusively going to Mac OS X. It eliminates the need of running a VM. It eliminates the need to find workarounds like Cygwin.

But, that doesn’t mean that the resourceful Linux community won’t try to run Ubuntu desktop apps on Windows, through WSL. There are already reports that many enthusiasts have managed to run Linux desktop apps on Windows. That’s a byproduct, however, not a focus area. 

Who Is the Winner: Ubuntu or Windows?

One discussion that I see a lot on the social network is whether “Ubuntu for Windows” is going to hurt desktop Linux in the long run. Currently, many Windows users need to dual boot with Linux or run it in VM to be able to use such tools. That need created a user base; it created a mind share.

I meet a lot of developers who run Linux on their systems just to be able to use such tools. These are also the developers who work for companies like Spotify and other services. They are the ones working on creating unofficial ports of such services for Linux, because Linux is their primary desktop. Being able to do so with Windows eliminates the need to run Linux anymore. Now Windows can be their primary desktop, and they don’t have to worry about porting such services and apps to Linux because they just work fine on Windows.

That’s the perception a lot of users have, and Dustin Kirkland is of the opinion that it certainly doesn’t hurt Ubuntu’s mind share. He says, “Quite the opposite, think about how many millions more people we’ll be able to reach with Ubuntu! Think about people who work for an employer whose corporate desktop environment is Windows, and only Windows. Think about students who go to high school or college and are issued, or required, to run a Windows machine. These are desktop users who will be one command (bash) away from taking their first steps into a brave new world of Ubuntu and free software. Never in the history of Linux, free, or open source software have we had a better opportunity to put free and open source software in the hands of basically every desktop user in the world!”

The takeaway from this development is that now you can run Linux tool natively on Windows. One more platform to run open source. I call that a victory.