Windows Subsystem for Linux – Bash on Windows
Better Windows Development Workflow with WSL Pt 1

By codeitadmin April 3, 2018 • Posted in: Automation, Linux, Windows Development, WSL

The WSL (Windows Subsystem for Linux) project, also known as bash on windows, aims to reduce some of the friction you might feel when developing on a Windows system, and make your local work flow more closely resemble your remote environment. It does this by giving you access to a large subset of features from the Linux distribution of your choice. That means you can run loads of useful *nix tools on windows (bash, lamp-server, python an much more), natively. Currently only Ubuntu, Kali and few other flavors are officially supported, but this is an open source project and there is potential for any or all of the more popular distributions to make their way to the platform in the near future.

Why Bash on Windows?

There have always been options for Bash on Windows, namely GitBash or a virtual machine running a linux distribution. Both are great options but have a few limitations

Gitbash/Cygwin has always been a great option. It’s a fantastic piece of software that gives you access to a large number of bash commands, as well some other handy things like the ability run shell scripts. The main downside though, is that while it feels Unix like, at the end of the day, it’s just a series of wrappers over native functions. That means you don’t get the advantage of a package installer, and even if you did Windows wouldn’t know what to do with the packages natively.

The more robust option has always been to have Linux running inside a virtual machine. This gives you all of the functionality, but it has some downsides too. The first big downside is that the virtual machine, by default, has no access to the local filesystem. There are options to create shared folders between systems, but to me that process has always felt a little clunky, and requires configuration within the Virtual Machine, which isn’t always that intuitive. The other big downside is that Virtual Machines require a lot of resources, since you are essentially running an OS on top of an emulated machine, on top your host OS. This isn’t necessarily a big deal if you have a fairly high-powered machine, but when you running it alongside the other tools in a common workflow(PhotoShop, Illustrator, An IDE, etc;) it can really impact performance on a low to mid-range machine.

Native Bash on Windows via WSL offers us a nice middle ground, as we get access to many familiar commands, as well as package installers, and support for a large number of packages (not everything is supported, but more on that in a second), without the overhead of a VM. Bash also has access to the host filesystem, without any additional configuration.

Limitations of Bash on Windows

A quick word of warning:

At the time of writing, WSL is not a perfect solution. There are a few things that may be a deal breaker for some users. The most common are:

I/O latency – Some file operations are a little slow using the bash tools. In my experience, it hasn’t been a huge problem, although writing large files does occasionally hang my machine.

Lack of package support – Most of the packages I use on a regular basis have worked just fine. No issues with apache-server, php, mysql, yarn, python3 and several others. There are some packages, however that have many reported issues. There is community maintained compatibility list that is a good starting point, however, it doesn’t appear to be completely up to date, as several packages are poorly rated, which seem to be working fine since the official release

What can you do with WSL?

  • Use Linux command line utilities to work on Windows files – though as of now the opposite is not true.
  • Create a local development LAMP server without the need for a Virtual Machine, or a program like WAMP, AMPPS, etc;
  • Use Bash scripts to automate repetitive tasks – no need for GitBash or Cygwin
  • open SSH without PuTTY or Git BASH
  • Native Git support

Getting Started

Getting started with WSL is a snap. All we need to do is:

  1. Enable it
  2. Install a distribution
  3. A tiny bit of setup to give us access to the files we want to work with

That’s it. The whole setup process shouldn’t take more than 30 minutes!


Enable WSL in Windows Features

  1. In the search bar, start typing ” Turn Windows Features On or Off
  2. In the box that appears, check the box that says “Windows Subsystem for Linux” fig 1
  3. Click Ok
  4. When prompted, restart your machine
Windows Features Turn Windows features on or off To turn a feature on, select its check box To turn a feature off, clear its check box. A filled box means that only part of the feature is turned on. D Direct Telnet Client D TFTP Client Windows Defender Application Guard Windows Identity Foundation 3.5 Windows PowerSheII 2.0 Windows Process Activation Service Z] Windows Subsystem for L inux Windows TIFF IFilter Work Folders Client Cancel O  


Fig 1. The Windows Add / Remove Features Dialog

Installing a Distribution

  1. Go to
  2. If prompted, select Open Microsoft Store
  3. Select Ubuntu from the Microsoft store page. You may use any of this distributions, however, if you are new to Linux it is recommended to follow along with Ubuntu, as some commands and programs vary between distributions.
  4. Select “Get”
  5. Run the Ubuntu installer. This will open a bash session
  6. When prompted enter a user name. This does not need to match your Windows usernameFig 2
  7. When prompted, enter a new password for Linux. This will be your root password for elevating from the Bash command prompt
  8. When the install is finished open Windows Powershell
Llbuntll Installing, this may take a few minutes.. Installation successful! Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: Enter new UNIX username: bryan  




Fig 2: Ubuntu Installer

You should now be in the Powershell command prompt in Windows. From this prompt there are two ways to run Bash for windows.

To open an interactive Bash prompt you can type


or if you just need to run a single command you can do so by typing

wsl <your_bash_command_here>

In Part two we will look at some additional setup that will help start using this to streamline our work flow.


add comment

Your comment will be revised by the site if needed.