Getting Windows Subshell for Linux working

If you’ve been working with Cygwin or MinGW, you may want to step over to Windows Subsystem for Linux (WSL) to take advantage of building and running tools in that environment. While the goal of Cygwin and MinGW has been to provide a Linux command-line tool set to Windows, it’s too easy to run the wrong tool (e.g., forgetting to install a tool in one environment, and picking up the identically named tool in another). In fact, many tools install their own private copy of MinGW (Git for Windows, SourceTree, Vagrant, …), so you find yourself constantly manipulating the search path.

Cygwin and MinGW have several short comings which don’t make it the best choice anymore, at least for command-line tools. While one can run Windows programs (including GUI) in either the Cygwin or MinGW environment, and vice versa, it’s cumbersome to update the environment to include missing tools. As it tries to straddle the incompatible worlds of Windows and Linux, many tools are not available, thus require porting the software to build in the environment (Cygwin or MinGW). This can often be difficult for command-line tools, let alone for GUI tools. As an alternative to porting to Windows, one can use a Linux virtual machine to run the software you’re interested in. But, that is a cumbersome process. With the new WSL Bash, you can integrate directly with Linux command-line programs via “bash -c …”. In a way, it’s a tacit admission that the command-line tools are better in the Linux world.

In order to use WSL, make sure you have enabled the WSL feature by following the instructions at the Installation Guide ( Where it asks you to run Bash on Windows, use Cmd or Powershell. Make sure you turn off “Use Legacy Console” by right-clicking on the window, then opening up the Properties, and deselecting the option:

Once this is done, type “where bash.exe” in the Cmd or Powershell window. Verify the first location listed is in fact C:\Windows\System32\bash.exe:


Type “bash.exe” or the full path “C:\Windows\System32\bash.exe” if the first file listed is incorrect. Continue with the installation.

After it installs, you will have a bare-bones shell with tool set. If you plan on developing software, you may want to apt-get a number of things. In fact, many useful tools just don’t build on Windows, or the instructions are completely out of date, e.g., Swig (a tool to generate a thunking layer for a library).

  • sudo apt-get install gcc
  • sudo  apt-get install libpcre3 libpcre3-dev
  • sudo apt-get install make
  • sudo apt-get install ‘g++’





Posted in Tip