An introduction to Windows Subsystem for Linux

An introduction to Windows Subsystem for Linux

Hi lovely readers,

If you are someone who uses a Windows computer and is interested in learning how to run Linux applications on it, then you have come to the right place. In this blog post, I will explain what WSL is, how to install and use it and offer tips and tricks for working with it. By the end of this post, you will have a better understanding of what WSL is and how it can benefit you. Let's get started!

What is WSL?

WSL, which stands for Windows Subsystem for Linux, is a feature in Windows 10 and later versions that allows you to run Linux applications directly on Windows. WSL does this by providing a compatibility layer between Windows and Linux, which allows you to access Linux commands and utilities from a Windows command prompt or PowerShell.

WSL provides a way for Windows users to use the Linux command line and run Linux applications without the need for a separate Linux virtual machine or dual-boot setup. This is especially helpful for developers or users who rely on Linux applications but like to work on the Windows operating system.

How to get started with WSL

First of all, you need a Windows PC. If you’re using something older than Windows 10 (Why though?) you will need to use WSL v1. Because I believe most of you will be running Windows 10 or 11 by now, I’ll focus for this blog post on getting started with WSL v2.

To get started with WSL v2, you first need to enable the feature on your Windows computer. Here's how to do it:

  1. Open the Start menu and search for "Turn Windows features on or off".

  2. Click on the search result to open the "Windows Features" window.

  3. Scroll down the list and look for "Windows Subsystem for Linux". Check the box next to it to enable the feature.

  4. Click "OK" and wait for the feature to be installed. This may take a few minutes.

  5. Once the installation is complete, restart your computer.

Now that you have enabled WSL, you can choose which version of WSL you want to use. Here's how to do it:

  1. Open the Microsoft Store app on your computer.

  2. Search for "Linux" or the name of the Linux distribution you want to use. I would recommend Ubuntu for beginners.

  3. Click on the distribution you want to use and then click the "Get" button to download it.

  4. Once the distribution is downloaded, open it and follow the installation prompts. This will create a new Linux environment in WSL.

Congratulations! You have now installed WSL and a Linux distribution on your Windows computer. You can now start using Linux commands and applications on your Windows computer through the WSL environment.

You can now search for the Linux Distribution you just installed or click on the ‘Open’ button next to the distribution you just installed.

The benefits of WSL

Running a Linux environment natively on Windows can be incredibly useful, and this is exactly what Windows Subsystem for Linux (WSL) can help you with. There are many benefits to using WSL, including improved compatibility, access to Linux tools and libraries, and easy setup.

One of the biggest advantages of using WSL is improved compatibility. A lot of developers want to use Linux for their work, as it offers a more stable and faster environment for coding. However, this can be challenging if you are working on a Windows machine, as you may encounter compatibility issues or need to constantly switch between different operating systems. WSL allows you to run Linux tools and libraries directly on Windows, which means you can develop and test your code in a Linux environment without having to leave the Windows operating system.

Another benefit of using WSL is access to Linux tools and libraries. Linux has a lot of amazing open-source tools and libraries that are very useful, and WSL allows you to use these tools without having to set up a separate Linux environment. This can save a lot of time and effort.

Finally, WSL offers a very easy setup process. In the past, setting up a Linux environment on a Windows machine was complicated, because you had to set up a Virtual Machine, or you had to have a dual boot on your PC. However, WSL makes this process much easier, as it is integrated directly into the Windows operating system. This means that you can install and set up a Linux environment quickly and easily, without needing to worry about configuring your system or troubleshooting issues.

The use cases

Personally, I really like to use WSL when I want to run something that is running on Docker. If you want to run Docker on Windows you HAVE to install Docker Desktop. That’s not the case in the Linux CLI. WSL also allows you to run other Linux CLI tools, such as Apache or MySQL, directly within Windows. This means that you can use those packages without any additional software that might come with a Windows installment.

Another scenario where WSL is useful is in data science. Many data science tools and libraries are built for Linux. WSL allows you to take advantage of the full range of data science tools and libraries available on Linux, without having to switch between operating systems or set up a separate environment.

Also, all other tools and libraries that are only available for Linux can be run from WSL very quickly. Even GUI applications can be run from WSL!

That’s a wrap!

In conclusion, Windows Subsystem for Linux (WSL) is a powerful tool that allows you to run a Linux environment natively on Windows. It offers a lot of f benefits, including improved compatibility, access to Linux tools and libraries, and easy setup. Whether you are a web developer, data scientist, or simply need access to Linux-based command-line tools, WSL can make your work easier.

If you are a Windows user who needs access to Linux-based tools or environments, or if you are interested in exploring the world of open-source software, Windows Subsystem for Linux is a tool that you should consider.