Discover the Magic of WSL: Transform Your Windows Experience with Linux Integration


Introduction
Windows Subsystem for Linux (WSL) lets you run a full-fledged Linux environment directly inside Windows without needing a virtual machine (VM) or dual-boot setup. It allows developers to use Linux tools, scripts, and applications seamlessly within Windows.
In this guide, we'll cover:
What WSL is and why you should use it.
How to install WSL on Windows.
How to set up a Linux distribution.
Using WSL for development.
Running GitHub self-hosted runners inside WSL.
What is WSL? Why Should You Use It?
WSL is a compatibility layer in Windows that allows running Linux commands natively. It removes the need for virtual machines and provides near-native performance.
Why Use WSL?
Develop on Linux while using Windows
Access Linux commands (
ls
,grep
,awk
, etc.)Run Bash scripts without switching OS
Use Linux tools like Docker, Git, and Python
Install Linux software via
apt
oryum
Work with cloud-native tools (Kubernetes, Terraform, AWS CLI)
Installing WSL on Windows
The installation process is simple and requires just one command on Windows 10/11.
Step 1: Enable WSL
Open PowerShell as Administrator and run:
wsl --install
This command:
Installs WSL
Sets up Ubuntu as the default Linux distribution
Note: If you have an older version of Windows (before Windows 10, Version 2004), follow the manual installation guide.
Step 2: Restart Your Computer
After installation, restart your system for changes to take effect.
Step 3: Verify Installation
After rebooting, check if WSL is installed by running:
wsl --list --verbose
Expected Output:
NAME STATE VERSION
Ubuntu Running 2
If WSL is not running, start it with:
wsl
Choosing and Installing a Linux Distribution
By default, WSL installs Ubuntu, but you can install other distributions like Debian, Kali Linux, OpenSUSE, etc.
View Available Distributions
Run:
wsl --list --online
Expected Output:
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
Kali-Linux Kali Linux Rolling
Install a Specific Distribution
For example, to install Debian, run:
wsl --install -d Debian
To switch to another distribution later:
wsl -d Debian
Using WSL: Basic Commands
Once installed, open WSL by running:
wsl
This will drop you into a Linux shell (bash
). You can now run Linux commands:
Command | Description |
ls | List files in the current directory |
pwd | Show current directory path |
cd /path/to/folder | Navigate to a directory |
cat file.txt | Display contents of a file |
nano file.txt | Edit a file |
apt update && apt upgrade | Update system packages |
exit | Exit WSL |
Tip: You can open a WSL terminal directly by typing "wsl" in the Windows Run (
Win + R
) dialog.
Setting Up Development Tools in WSL
WSL allows you to install and use Linux-based development tools seamlessly.
Install Git
sudo apt update
sudo apt install git -y
git --version
Install Docker (For running containers in WSL)
WSL 2 allows running Docker natively without a VM.
sudo apt install docker.io -y
sudo service docker start
docker --version
To run Docker as a non-root user:
sudo usermod -aG docker $USER
newgrp docker
Install Node.js and NPM
sudo apt install nodejs npm -y
node -v
npm -v
Install Python and Pip
sudo apt install python3 python3-pip -y
python3 --version
pip3 --version
Running a GitHub Self-Hosted Runner in WSL
You can use WSL as a self-hosted runner for GitHub Actions!
Step 1: Create a Self-Hosted Runner on GitHub
Go to your repository
Click Settings β Actions β Runners
Click New Self-Hosted Runner
Select Linux as OS and follow the instructions
Step 2: Install and Configure the Runner in WSL
mkdir actions-runner && cd actions-runner
curl -o actions-runner.tar.gz -L <GitHub Download Link>
tar xzf actions-runner.tar.gz
./config.sh --url <your-repo-url> --token <your-token>
Note: Replace
<GitHub Download Link>
and<your-token>
with values from GitHub.
Step 3: Start the Runner
./run.sh
Now, your GitHub workflows will execute on WSL instead of GitHub-hosted runners. π
Common Issues and Fixes
WSL Not Found Error
If wsl --install
doesnβt work, manually enable it:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Then, restart your computer.
Docker Not Running in WSL
Run:
sudo service docker start
To make it start automatically:
sudo systemctl enable docker
Final Thoughts π‘
WSL bridges the gap between Windows and Linux.
WSL 2 is fast and lightweight, making it ideal for development.
You can use WSL as a GitHub self-hosted runner for better control.
Install and configure WSL in just a few commands!
Subscribe to my newsletter
Read articles from Jasai Hansda directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Jasai Hansda
Jasai Hansda
Software Engineer (2 years) | In-transition to DevOps. Passionate about building and deploying software efficiently. Eager to leverage my development background in the DevOps and cloud computing world. Open to new opportunities!