empowering creative people

Linux In Windows

The Windows Subsystem for Linux (WSL) is a powerful new feature that lets you run a Linux terminal from within windows. You may wonder why you would want this, but it actually is great for developers. A lot of Web and open source toolchains are developed and maintained solely for the Linux system. For example, compiling the MicroPython firmware is nearly impossible under windows but very easy on a Linux system. The WSL gives you access to all of those great open source tools and from within your windows system and even allows the Linux terminal to access the windows file system.  

Enabling Windows Subsystem for Linux

The first step in installing WSL is to enable the subsystems in the windows features. To get there we will start by typing Control Panel into the Start Menu.

Open the control panel

In the Control Panel we need to open Programs and Features, in here we want to choose Turn Windows features on or off. In this list, we want to scroll all the way to the bottom of the list and tick Windows Subsystem for Linux.

Enable the windows subsystem for linux.

Now we click ok and close the control panel. 

Alternatively, you can enable WSL by running the following command in the PowerShell terminal.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Once you have enabled WSL you will need to restart your computer so that the changes can be made to the system.

Install a distribution

The easiest way is to install using the Microsoft Store and searching for Linux and selecting the Run Linux on Windows Option.

install distribution with microsoft store

This can also be done through PowerShell by using the command the command, with the URL changed to the distribution you wish to install. A full list of instructions and distributions can be found in the WSL install manual.

Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing

After the Installation has completed you will be able to run your WSL instance by searching the name in the start menu. I have used Debian because this is the version of Linux the Raspberry Pi OS is built off.

Run the Debian linux subsystem

Enter a username with all lowercase and set a password you will remember. 

Create a Linux user name and password

Updating and installing programs

The first thing we will do is make sure that the

The first time we run a sudo Command it will show us a message reminding us to be careful and to enter the password we just set.  

sudo apt-get update

First time sudo is used you will get a warning.

Now we will run

sudo apt-get upgrade

Once this has run there are a few packages we are probably going to want to install no matter what we are planning to do.

sudo apt-get install make
sudo apt-get install git
sudo apt-get install python3

Accessing Windows file system from WSL

You can access all of the files on your windows system by navigating to the /mnt directory. The mnt directory will contain a list of all the active local drives by their letter. You can navigate them as you would on any Linux system.

cd /mnt
ls
cd c

Access to the windows file system.

Conclusion

Now you have access to a lot of powerful development toolchains within your windows environment. There are a few limitations with this system compared to running a full Linux distribution, but it is a very useful and time-saving tool for anyone who primarily runs windows. If you would like to know more about the Windows Subsystem for Linux, Microsoft has a product page with guides and FAQs.

If you have any question about the WSL or have some ideas you want to share join the discussion below. 

The Windows Subsystem for Linux (WSL) is a powerful new feature that lets you run a Linux terminal from within windows. You m...

Have a question? Ask the Author of this guide today!