Windows Subsystem for Linux

Sometimes, but mainly for website development I want to use a Linux machine. I don’t want to buy another machine to install Linux on, or create a Virtual Machine on my Windows machine. I simply want to run most Linux command-line tools, utilities, and applications — directly on Windows.

Luckily for me I found this description on the Microsoft documentation web site. You can define your own Linux distro, you can choose a distro from the Windows Store. After setting up a Windows sub system for Linux, you need to add a user. In the following blogs is described how you can use WSL.

The interoperablility part shows some usefull examples:

  • Run Linux tools from a Windows command line
  • Run Windows tools from WSL
  • Share environment variables between Windows and WSL

Code example

C:\temp> bash -c "ls -la" | findstr foo
C:\temp> dir | bash -c "grep foo"
C:\temp> bash -c "ls -la" > out.txt