🐧WSL (Windows Subsystem for Linux)
For developers who love the flexibility of Linux but crave the familiarity of Windows, the Windows Subsystem for Linux (WSL) is a game-changer.Put an end to cumbersome dual-booting and awkward virtual machines. With WSL, you may run full Linux distributions on your Windows 10/11 computer and easily incorporate them into your current workflow.
💻Getting Started: Setting Up your WSL Playground
WSL's simplicity of usage is what makes it so lovely. Visit the Microsoft Store and select your preferred Linux distribution, such as Debian or Ubuntu. After a simple installation, you'll have a fully functional Linux environment coexisting with Windows in a matter of minutes.
💻Essential WSL Commands
The exciting part now is using the Linux command line with these foundational commands to get going.
cd
: Navigate directories, just like in Windowsls
: List directory contentspwd
: Print the current working directorymkdir
: Create new directoriestouch
: Create empty filesnano
orvim
: Text editorsapt update && apt upgrade
(Ubuntu/Debian): Update Linux distribution and installed software.sudo
: Run commands with admin privileges.
💻Supercharge Your Workflow: Development Tools at Your Fingertips
WSL opens up a huge world of potent Linux development tools. Install well-known programs like Git, Python, Node.js, and many more using apt or yum, two well-known Linux package managers. This gives us the ability to maintain your codebase, create apps, and utilize the wealth of Linux development tools.
💻Beyond Development: A Gateway to Open Source
WSL isn't limited to programmers. It provides access to the enormous realm of open-source software. WSL makes it simple to install and use a wide range of widely used programs, including web servers (Apache, Nginx), databases (MySQL, PostgreSQL), and system management applications. This lets you explore, pick up skills, and create robust apps all without ever having to leave the Windows environment.
💻Installation
🐧Enabling WSL and Virtual Machine Platform
Open PowerShell as - Administrator
Run the following commands one at a time, pressing Enter after each.
Make sure to restart System
PS C:\Users\gupta> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart Deployment Image Servicing and Management tool Version: 10.0.22621.2792 Image Version: 10.0.22631.3672 Enabling feature(s) [==========================100.0%==========================] The operation completed successfully. PS C:\Users\gupta> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart Deployment Image Servicing and Management tool Version: 10.0.22621.2792 Image Version: 10.0.22631.3672 Enabling feature(s) [==========================100.0%==========================] The operation completed successfully.
🐧Installing
The wsl --install
command will set WSL to version 2 by default.
PS C:\Users\gupta> wsl --install
Windows Subsystem for Linux is already installed.
🐧Set WSL 2 as Default Version (Optional)
PS C:\Users\gupta> wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.
wsl --set-version
( eg. wsl --set-version Ubuntu-20.04 2
)- This will be used to update the version
🐧Lists Available Distros to Install
PS C:\Users\gupta> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
We can refer the Link to see multiple basic commands of WSL at Microsoft website.
🐧Installation through PowerShell or Microsoft Store
You can either use cmd directly to install Linux distro or go to Microsoft store to install it.
PS C:\Users\gupta> wsl --install -d Debian
Debian GNU/Linux is already installed.
Launching Debian GNU/Linux...
💻Conclusion
For developers or individuals who want a Linux environment, WSL offers a smooth integration of Linux on Windows. With the help of this article, you can increase your development efficiency and set up WSL.
Note
Multiple contents were already available on the Microsoft website and were taken from there.
Subscribe to my newsletter
Read articles from AJEET GUPTA directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
AJEET GUPTA
AJEET GUPTA
Hi there! I’m Ajeet, a System Administrator with three years of experience in managing both on-premises and cloud infrastructures. I’m all about using ITIL practices to automate tasks, solve problems, and keep systems running smoothly.