Developing with WSL onWindows: How It Works and How to Use It Effectively
After working with macOS and Linux for years, swithing to Windows felt unfamilir. PowerShell didn’t feel intuitive, and Git Bash was limited. That’s when I discovered WSL (Windows Subsystem for Linux) — a built-in feature in Windows that lets you run a full Linux environment alongside your Windows tools.
At first, it seemed too good to be true — installing Ubuntu inside Windows and using apt and Linux-native commands directly in a Bash terminal. It felt like a full Linux environment, tightly integrated into Windows. But as I began using WSL more seriously, a few important questions came up:
- Is WSL just a virtual machine under the hood?
- Is it similar to Docker?
- Is the Linux user the same as my Windows user?
- How does file sharing work? Can I use it like mounting shared folders in VirtualBox?
- What about networking between WSL and Windows?
These questions led me to learn more about WSL’s architecture and how to use it effectively for real-world development — especially when working with GitHub repositories, local development servers, and toolchains that need Linux.
How WSL Works (Compared to VM and Docker)
WSL comes into two versions:
- WSL 1: Translates Linux system calls to Windows calls. It does not use a Linux kernel.
- WSL 2: Uses a real Linux kernel running in a lightweight virtual machine managed by Windows.
WSL 2 feels like a middle ground between a full VM and a container runtime like Docker:
Understanding Users in WSL
WSL uses its own Linux user, which is completely separate from your Windows account. When you install a Linux distribution (like Ubuntu), it prompts you to create a new username and password specific to Linux.
You can check your current Linux user:
whoamiTools like git and ssh run under this user’s context, meaning they use this user’s home directory (~), config files (like ~/.gitconfig, ~/.ssh), and file permissions.
File Sharing: Accessing Windows from WSL and Vice Versa
WSL automatically mounts your Windows drives under /mnt. For example:
cd /mnt/c/Users/YourName/DesktopYou can read and write Windows files directly from within Linux.
From Windows, you can access Linux files through the special path:
\\wsl$\Ubuntu\This is similar to setting up shared folders in VirtualBox, but without the extra steps. In WSL, Windows drives are mounted automatically under /mnt, and Linux files can be browsed from Windows using the special path \\wsl$. You don’t need to manually configure shared folders, mount points, or install any add-ons — it works out of the box.
Networking: How WSL Connects to the Internet and Windows
WSL 2 has its own virtualized network interface but shares the host’s internet connection. Outbound traffic (like ping, curl, or git clone) works immediately.
When running a development server inside WSL, it can be accessed from Windows through localhost. For example:
npm run devThen open:
http://localhost:3000in your Windows browser.
Unlike a traditional VM where you’d need to set up port forwarding, WSL handles this out of the box.
Step-by-Step: Setting Up WSL and Verifying the Core Features
Now that we’ve covered how WSL works under the hood, let’s go through how to set it up and check the key aspects we discussed: user, file sharing, and networking.
1. Install WSL and Ubuntu
To install WSL with Ubuntu, open PowerShell as Administrator and run:
wsl --installThis command:
- Installs WSL 2 as the default backend
- Downloads and installs the latest Ubuntu LTS version from the Microsoft Store
- Sets it as your default Linux distribution
After installation, restart your computer if prompted. On first launch, Ubuntu will prompt you to create a Linux username and password.
Want a different Linux distro?
You can list available options:
wsl --list --onlineAnd install, for example, Ubuntu (like 24.04), run:
wsl --install -d Ubuntu-24.042. Check Your Installed WSL Distributions
In PowerShell, run:
wsl --list --verboseYou may see something like this:
NAME STATE VERSION
* docker-desktop Stopped 2
docker-desktop-data Stopped 2
Ubuntu-24.04 Stopped 2What is
docker-desktop?
If you have Docker Desktop installed on Windows, it creates internal WSL distributions (docker-desktopanddocker-desktop-data) to run Linux containers.
These are managed by Docker and should not be used for general development.
If docker-desktop is listed as default, you can change it by running:
wsl --set-default Ubuntu-24.043. Launch Ubuntu and Set Up Your Linux User
To start your Ubuntu WSL environment:
wsl -d Ubuntu-24.04On first launch, Ubuntu will ask you to:
- Create a Linux username
- Set a Linux password
After that, check your Linux identity:
whoamiThis is your Linux user — different from your Windows account — and it owns your files and config paths like ~/.gitconfig and ~/.ssh.
Now you’ll be in your Ubuntu 24.04 WSL environment, not the Docker VM.
You can verify with:
cat /etc/os-release
# You should see: PRETTY_NAME="Ubuntu 24.04.2 LTS"Then test:
pwd # Likely /home/<your-linux-user>
ls /mnt/c # Shows Windows C: drive4. Verify File Sharing (Windows ↔ Linux)
- From WSL (Linux → Windows):
cd /mnt/c/Users/YourName/Desktop
echo "Hello from WSL" > test.txtCheck your Windows desktop for test.txt.
Remove the test file (if you created one)
rm /mnt/c/Users/YourName/Desktop/test.txt
# If a file path contains spaces (like Jimin Byun), you can:
# Wrap the whole path in quotes, or
rm "/mnt/c/Users/Jimin Byun/Desktop/test.txt"
# Use a backslash (\) to escape the space
rm /mnt/c/Users/Jimin\ Byun/Desktop/test.txt- From Windows (Windows → Linux):
Open File Explorer and go to:
\\wsl$\Ubuntu-24.04\This gives you access to your Linux home directory (/home/<your-user>), similar to shared folders in VirtualBox — but with no manual setup.
5. Test Networking
In Ubuntu WSL, check internet access:
ping google.com
curl https://api.github.comThen start a local development server:
python3 -m http.server 8080
# you can simply stop this process by pressing: Ctrl + COpen your Windows browser and go to:
http://localhost:8080If it loads, that confirms WSL shares your Windows network — no need for port forwarding like in traditional VMs.
Why WSL Makes Development on Windows So Convenient
- No need for dual-booting or switching between operating systems
- No external VM tools like VirtualBox or VMware required
- Seamless file access — Linux can read/write to Windows drives via
/mnt/c/, and Windows can browse Linux files through\\wsl$ - Dev tools just work — whether it’s Git, Python, Node.js, or even Docker (via Docker Desktop), you can use them as if you’re on a native Linux machine
- Local servers, localhost, and port sharing work out of the box — no more hacking together NAT or port forwarding
