Ubuntu on Windows 10 - The perfect blend

Tue, 2016-08-02 20:30

I am a kind of a strong believer that you don't need a GNU/Linux operating system to be a software developer. I have several friends who own happily use MacOS and Linux operating systems. I never missed any of those awesome features the GNU ecosystem had, thanks to the Cygwin, msys packages, and everyone who spent their valuable time making sure their software run well on Windows as well. If there is no way to run a particular software or tool on Windows, you always have VMWare or Hyper-V to spin a VM of any operating system.

When I saw the news about Windows Subsystem for Linux (WSL), I was rather expecting a virtual machine at first. I also watched some videos from Microsoft WSL blog, and they all looked surprisingly good. I jumped in and upgraded to Windows 10 anniversary release as soon as it was released. The update took several minutes, but the upgrade was well worth it.

Sure the Windows 10 anniversary update comes with a bunch of new features and improvements, but arguably, WSL is the best new feature that can change how many developers would work. It is not even mentioned in the Windows 10 features page.


  • You need a 64 bit processor for this. Head over to the Windows update, and update to the latest version. The update will take several minutes to complete.
  • Once done, search for Use developer features in the start menu, open the control panel item, and opt to "Developer mode" if you have not already.
  • Next, search for Turn Windows features on or off in the start menu, open the control panel item.
  • Enable Windows Subsystem for Linux. It says Linux and I really hope other Linux OSes will be supported soon as well. At least Debian at first given Ubuntu is based on Debian. You will have to restart your computer.
  • Windows Subsystem for Linux

  • Open the good ol' command prompt, and type bash. You will be prompted to accept the terms and license. This will take a few minutes to complete. A quick sniffing revealed it's downloading what appears to be a standard Ubuntu image (https://wsldownload.azureedge.net/trusty-server-cloudimg-amd64-root.tar.gz). You can do the same with the lxrun command.
  • WSL - lxrun

Hardware sharing

Microsoft has taken a really smart way with WSL. It is not without its drawbacks, but what you get is basically an Ubuntu virtual machine, with all your disk partitions mounted, and hardware readily available. This is different from the VMs, but it is not exactly a container either.

Your disk partitions are mounted at /mnt/c, /mnt/d, etc. each representing the partitions in your hard disk. USB drives get mounted automatically too, but it requires you to restart the bash prompt. You can access any file (some will require sudo from within both systems. WSL is located in C:\Users\USERNAME\AppData\Local\lxss, where the entire file system is readily available at the rootfs folder.

File systems are synchronized

Your CPU and other hardware is shared too. There is no dedicated RAM allocation. free command reports memory usage that matches with Windows Task Manager. The processes are different and you cannot access Windows processes from Ubuntu (for obvious reasons). top command does not show anything about the host.

procinfo from Ubuntu on Windows 10

Memory usage matched on Ubuntu on Windows 10

processes list from top command in WSL in Windows 10

Network sharing

Quite interestingly, the network interface is shared between Ubuntu and Windows. For example, you can run Apache on Ubuntu, and it will work quite well in your Windows browser. This is actually one of the best features of WSL. Ruby and Python for example does not work well with Windows, and this can be handy to overcome that. It also means no more Apache module compilations, PHP module incompatibilities, etc. Note that this is still a beta feature, and I wouldn't recommend you to run an actual server stack with this. WSL, from what Microsoft says, is a tool to have a POSIX environment within Windows and to help you have a quick Linux system to get particular tasks done; not a way for complete virtualization in harmony.

You can mix and match servers too (even though it would be a nightmare to maintain). Apache in Windows, sendmail and Redis on Ubuntu, etc.

To test this, I installed Apache2 on the Ubuntu WSL, and opened the port (I already had an Apache Windows process listening to port 80, so I had to change it in Ubuntu).

Apache in Ubuntu serving requests from Window host


  • It is still in beta stage, so it is probably too early to point out the bugs. apt worked beautifully, and every package I tried so far worked great. I still have to run a benchmark to see how Ubuntu can perform within Ubuntu. I however read that some packages do not work quite well yet.
  • Even though Ubuntu brought us this far, we are still limited to cmd.exe. It should work with Powershell as well, and there should be a way to integrate this with terminal emulators such as Console2 and Cmder.
  • When you close the last bash.exe prompt, the Ubuntu subsystem gets terminated too. Your cron tasks will not work, background tasks will terminate, and so on. If you need to keep something in Ubuntu running, you need to keep bash.exe open all the time.


Bash on Ubuntu on Windows provides a native subsytem that can directly run Ubuntu from within Windows. It is not virtualization, not containerization, but more like how Wine runs Windows on a Linux system. WSL is doing the same thing, in reverse.

Your thoughts