Windows Subsystem for Linux 2.0 Guide

Post Icon The Windows Subsystem for Linux (WSL and WSL 2) is a project to provide a Linux shell in Windows 10. With version 2, WSL provides a full blown Linux Virtual Machine with a Linux kernel. Therefore, after installation, you have a full Linux installation BUILT-IN to Windows 10. This makes your Windows PC or laptop on par with a Mac for running Linux. In fact it might be better.

WSL 2 Installation and Docker

To install WSL or WSL 2 you need to follow these steps.

After your launch the app on your desktop, if you are missing anything, you will be prompted on how to fix. After a few minutes and then the Linux subsystem should be installed.

Configure Docker Desktop

Once you have WSL 2 installed, Docker will detect it and then ask you if you would like to switch to WSL as your default VM. Choose yes to switch. After you select the switch, make the following changes to Docker.

Once you have done that, you can run Docker commands from Windows or from a Linux terminal. Very slick.

Note: Removing an old version of WSL

If you played around with the early beta versions of WSL, you may need to uninstall it. To do that run:

lxrun /uninstall /full

That should get rid of the old version. If that doesn't work, try lxrun /install to set it up again and then lxrun /uninstall /full again for the full delete.

WSL Tips

Access your Windows 10 Filesystem

Windows 10 WSL Mount External Drive

After you do that, D: should automount every time after that.

Useful WSL Commands

Run Windows Apps

Details can be found on SuperUser

The newest versions allow you to just execute what's in the path:

$ export PATH=$PATH:/mnt/c/Windows/System32
$ notepad.exe
$ ipconfig.exe | grep IPv4 | cut -d: -f2
$ ls -la | findstr.exe foo.txt
$ cmd.exe /c dir

WSL 2 Resources