Historically, running Linux on a Windows machine required one of two approaches:
- Installing Linux directly on hardware (potentially dual-booting)
- Running Linux inside a Virtual Machine
All approaches work, but they introduce additional complexity and resource usage.
Microsoft introduced Windows Subsystem for Linux (WSL) to allow Linux environments to run directly on Windows.
What Is WSL?
WSL allows Linux distributions to run on a Windows system without requiring a traditional Virtual Machine.
Conceptually:
Windows
↓
WSL
↓
Linux Distribution
This allows users to access:
- Linux commands
- Linux tools
- Linux shells
- Linux development environments
without leaving Windows.
Why WSL Exists
Many developers, engineers and security professionals prefer Linux tools.
Examples:
grep
awk
sed
curl
ssh
Instead of maintaining a separate Linux machine, WSL allows these tools to run directly on Windows.
WSL vs Virtual Machines
Virtual Machine
Windows
↓
Hypervisor
↓
Linux VM
Advantages:
- Strong isolation
- Full operating system
- Independent environment
Disadvantages:
- More RAM usage
- More CPU usage
- Larger storage requirements
WSL
Windows
↓
WSL
↓
Linux Environment
Advantages:
- Lightweight
- Fast startup
- Easy installation
- Minimal resource consumption
Disadvantages:
- Less isolated than a traditional VM
- Shares resources with Windows
- Not always identical to a standalone Linux system
WSL Versions
WSL1
The original implementation.
Used a compatibility layer to translate Linux system calls into Windows operations.
Linux Calls
↓
Translation Layer
↓
Windows
WSL2
The modern implementation.
Uses a lightweight virtualized Linux kernel.
Windows
↓
Lightweight VM
↓
Linux Kernel
↓
Linux Distribution
WSL2 provides significantly better Linux compatibility and is the recommended option.
Why Operators Use WSL
WSL allows operators to access Linux tools without leaving Windows.
Examples:
nmap
ssh
curl
python
git
This is especially useful for:
- Development
- Automation
- Scripting
- Networking
- Security research
Many operators use Windows as their primary workstation while leveraging Linux tooling through WSL.
Installing WSL
Open an elevated PowerShell:
wsl --install
Reboot when prompted.
After installation:
wsl --list --online
View available distributions.
Install Ubuntu:
wsl --install -d Ubuntu
Launch Ubuntu:
wsl
or
ubuntu
Useful WSL Commands
List installed distributions:
wsl -l -v
Shutdown WSL:
wsl --shutdown
Start a distribution:
wsl
Open a specific distribution:
wsl -d Ubuntu
Update WSL:
wsl --update
Accessing Files
Windows can access Linux files.
Linux files are typically located at:
\\wsl$\
Example:
\\wsl$\Ubuntu\home\student
Likewise, Linux can access Windows drives:
/mnt/c
/mnt/d
Example:
cd /mnt/c/Users/Student/Desktop