What are the differences between Windows Bash and Cygwin?
The new update from Windows with "Linux" Bash is new, but what differences are there to Cygwin that might make you choose one over the other?
Cygwin is a great tool if you want to live entirely in Windows and want to drive/automate Windows tasks with bash scripts. However, Cygwin is unable to run unmodified Linux binaries.
That's where WSL steps in:
The Windows Subsystem for Linux (WSL), is a new layer of the Windows kernel which aims to provide a high degree of compatibility with the Linux kernel ABI. This allows native, unmodified, Linux ELF64 binaries to run on WSL.
This is how WSL can run a genuine Ubuntu user-land distro, and any packages you download from apt-get, or .deb packages from elsewhere, without any changes.
The point of WSL is to enable developers working on Windows to be able to run many of the tools, and to work on many projects, which depend on Linux binaries, features, behaviors, filesystem layout, process model, etc.
While WSL is still early in its implementation, we're working hard to improve the breadth and depth of our syscall implementations to steadily improve WSL's ability to run an ever larger set of tools, and support a rapidly growing number of Ruby, Java, node, etc. packages and projects.
Since writing the above, we've shipped Windows 10 Creators Update which MASSIVELY improves WSL's compatibility with MANY of the tools you'll want/need to run.
Development has also continued unabated and we've been shipping Win10 Insiders builds over the last few months on the way to the Fall Creators Update (FCU) shipping in Oct 2017.
In FCU, we're adding the ability to install and run more than one distro side-by-side: Ubuntu, openSUSE, and SLES are currently available, with Fedora and others on the way. WSL also now supports USB-serial comms, and mounting of USB-storage and network shares, along with further improvements to our syscalls which improves compatibility with more tools.
I've been using WSL under Windows 10 for about a few months. Finally I can boot into Windows for gaming and still access the bash prompt and run CLI and many GUI programs. There are limitations such as none of the familiar Linux kernel virtual directories. Planning is required to share the same Bash script between Ubuntu and WSL on a dual boot machine.
There are lots of things I'd like to see improved, but I can live with it as is for a year or so.
One thing to remember is Microsoft is a closed system, and you don't get the flurry of third parties writing updates like you enjoy on Linux. But all things considered you buy a new laptop and it comes with Windows 10 anyway so you could say it's "free" at least :)
Cygwin has 15 years of updates. Notable is the same project manager has been in place since 2003. There are lots of full time maintainers and many more volunteer contributors.
WSL provides major updates twice a year every spring and fall. Weekly minor updates are available to those on the Developers subscription list. Although Microsoft has resources to throw thousands of people into WSL development it appears you can count the team members with your fingers.
You'll see many complaints about WSL speed. For example, screen painting takes many times longer in Windows 10 versus Ubuntu 16.04, i.e. you can actually see the cursor move in Windows 10:
It takes about 5 seconds for the WSL Bash splash screen to paint. By comparison it is about 1 1/2 seconds for the same splash screen in Ubuntu 16.04:
Cygwin has its own share of speed complaints with Bash.
The answer here is one year old, so I think a little update is in order. With Windows 10 Home, if it's 32 bit Windows, it means it won't run the 64-bit Ubuntu / Windows Subsystem as Microsoft tells us here: (windows Linux subsystem in win10 HOME BASIC).
It's like a dream come true running Ubuntu on Windows with its superior gaming support for Nvidia, but before you run out and buy a new (or used) laptop, make sure it has Windows 10 64 bit and not the 32-bit home version if you want to run Ubuntu / Linux stuff natively under Windows. On Microsoft websites they actually refer to the Windows Anniversary edition as a prerequisite to running Windows Subsystem for Linux.
However if you don't want to shell out $200+ for Windows 10 and you have an older laptop running Windows 8.1 64-bit like I do, and you have an even older laptop running Windows Vista 64 bit like I do, then Cygwin is the answer.
Cygwin supports more versions of Windows as their website lists:
Cygwin can be expected to run on all modern, released versions of Windows. State January 2016 this includes Windows Vista, Windows Server 2008 and all later versions of Windows up to Windows 10 and Windows Server 2016. The 32 bit version of Cygwin also runs in the WOW64 32 bit environment on released 64 bit versions of Windows, the 64 bit version of course only on 64 bit Windows.
Keep in mind that Cygwin can only do as much as the underlying OS supports. Because of this, Cygwin will behave differently, and exhibit different limitations, on the various versions of Windows.