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.
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.
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.
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.
Benefits of Using Windows Subsystem for Linux
WSL offers numerous advantages that make it an attractive option for developers:
You May Also Like: Ultimate Guide to Master Docker (DevOps) Skills
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:
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
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:
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:
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: