WSL feature image - hashtechwave

What is WSL? How can you setup Linux on Windows: Full Guide

Syed Safwan Abbas
By Syed Safwan Abbas - Full Stack Web Developer 7 Min Read

The Windows Subsystem for Linux (WSL) has caused a breakthrough in development as this tool have features that help developers to cross the operating systems barrier. In the current edition, Linux is executed directly within Windows by creating an environment that is the two worlds to the best of their capabilities.

- Advertisement -

In this guide, we will discuss the nature of WSL, its pros over traditional virtual machines and the way to get started with WSL on your Windows system.

Understanding WSL: Windows Subsystem for Linux

WSL is a software layer that is made to run Linux executables directly on the Windows platform. It builds the Linux set up on the Windows OS without necessitating the dual-boot arrangement or classical virtual machines.

- Advertisement -

This implies that developers can now run Linux commands and applications together with their Windows applications, thus, improving productivity to a great extent.

What Versions Are In Windows Subsystem for Linux

Windows Subsystem for Linux has two versions. Each version offers unique features and improvements over the other. Understanding the differences will help you choose the best version for your needs.

- Advertisement -

WSL 1:

On August 4, 2016, It was first introduced with the ability to run Linux distributions on Windows. Naturally, it is a compatibility layer hence, it is not a perfect solution. This method is indeed effective however, it may be the reason for performance issues sometimes, especially for those applications that use system calls extensively.

WSL 2

On May 2019, It was launched in which was an improved version of previous release. It uses a lightweight virtual machine to run a real Linux kernel by providing improved performance and greater compatibility with Linux applications. It is significantly faster and more efficient by making it the recommended version for most users.

- Advertisement -

Benefits of Using Windows Subsystem for Linux

WSL offers numerous advantages that make it an attractive option for developers:

  • Seamless Integration: Allows users to run Linux tools alongside your Windows applications by making it easy to switch between environments.
  • Performance: Windows Subsystem for Linux 2 delivers improved performance, especially for file-intensive operations.
  • Resource Efficiency: Unlike traditional virtual machines, It require not much resources.
  • Access to Linux Tools: Developers can apply a wide range of Linux command-line tools directly from Windows.
  • Visual Studio Code Integration: Providing powerful development environment that supports both Windows and Linux workflows.

You May Also Like: Ultimate Guide to Master Docker (DevOps) Skills

- Advertisement -

How to Install WSL on Windows

Before setting up Windows Subsystem for Linux, you need some requirements to be fullfilled which includes, to enable Virtual Machine Platform Feature on Windows 10 version higher than 1903 or on Windows 11. Now follow all of below steps to successfully enable WSL:

Step 1: Enabling WSL and Virtual Machine Platform (Using Powershell)

This is the first step where you need to open Powershell as administrator and enter below command to enable WSL for your machine:

- Advertisement -
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Right after enabling Windows Subsystem for Linux, You need to enable virtual machine platform feature as well and right after executing below command, you need to restart your pc:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

After restarting, you may want to set Windows Subsystem for Linux 2 as your default version. In PowerShell, run the command below for it:

wsl --set-default-version 2
  • WSL features enabling steps - hashtechwave
  • WSL Features enable on Windows - hashtechwave

Step 2: Installing Required Linux Distribution

Once WSL is enabled, you can install a Linux distribution of your choice, for that you have multiple ways of installing Linux on Windows Subsystem. You can do this by following few easy steps:

  • Open up Microsoft Store
  • Search “Linux” to choose available distributions.
  • Select your prefered distributions ( Debian, Kali, Ubuntu etc.) and Click Install.

Step 3: Start WSL and Some Basic Commands (Optional)

All done! You can now make use of Linux commands and necessary tools in your Windows environment. To get to your Linux environment just type “wsl” in the command prompt or search for the distribution you have installed in the Start menu.

Some Basic Linux Commands

Once you have installed a Linux any distribution, you can start using it immediately. Here are some basic Linux commands to help you get familiar:

  • ls: List all files and folders in current directory
  • cd: Change directory. e.g. Use “cd ..” command to move one directory back
  • mkdir: To creates new directory use this command.example: mkdir hashtechwave
  • touch: create new file following name of file. example: “touch index.html”
  • rm: Removes a file. Use rm -r to remove a directory

Conclusion: Why WSL Matters

WSL is very important for those people who want flexibility of Linux while staying on Windows. This technology has made development very much straight by helping users to be in the flow and at the same time, it enables them to avoid the complex setting. Simply WSL is the tool that bridges two different operating systems, thereby allowing the user to seamlessly utilize the advantages of the two Operating Systems in a single integrated environment.

Editor’s Recommendation:

Share This Article
Full Stack Web Developer
Follow:
Syed Safwan Abbas is the owner of HashBitStudio, a digital solutions agency specializing in web development, branding, and digital marketing. He also runs HashTechWave, a popular blog focused on tech and entertainment. As a full-stack developer with expertise in MERN, Next.js, and a wide range of web technologies, Safwan is passionate about creating innovative digital experiences. Before founding HashBitStudio and HashTechWave, he gained extensive experience in both frontend and backend development, refining his skills across various roles. When he's not building cutting-edge websites or writing insightful blog posts, Safwan enjoys exploring the latest tech trends, experimenting with new frameworks, and working on creative projects.