#
I had WSL installed on my laptop for a long time.
I don’t remember when or why I installed it. Probably while following some tutorial or trying something out. But after installing it, I never really used it. It just sat there.
Recently, I decided to actually explore it.
What I found was surprisingly powerful.
WSL2 (Windows Subsystem for Linux) lets you run a real Linux environment inside Windows.
Without:
It gives you:
Short answer: yes, but not like the ones you are used to.
WSL2 uses a lightweight virtual machine powered by Hyper-V.
The difference from VirtualBox:
So you get VM-level isolation with near-native usability.
Think of it like this:
[ Windows OS ]
↓
[ Hyper-V (hidden) ]
↓
[ WSL2 lightweight VM ]
↓
[ Linux Kernel ]
↓
[ Distros (Ubuntu, Docker, etc) ]
This mental model cleared most of my confusion.
Each WSL distro is stored as a .vhdx file.
This is a virtual hard disk containing the entire Linux filesystem.
Example locations:
So your “Linux system” is basically a single growing file.
When I first opened WSL, I saw:
docker-desktop:/#
I thought my system was broken.
Turns out:
docker-desktop)So I wasn’t in Ubuntu. I was inside Docker’s internal environment.
I installed Ubuntu using:
wsl --install -d Ubuntu
Then:
Since C drive space was limited, I moved it:
wsl --export Ubuntu D:\WSL\ubuntu.tar
wsl --unregister Ubuntu
wsl --import Ubuntu D:\WSL\Ubuntu D:\WSL\ubuntu.tar --version 2
Now my Linux system lives entirely in D:.
One of the most useful features:
Windows drives are mounted inside Linux:
C: → /mnt/cD: → /mnt/dSo I can do:
cd /mnt/d/my-project
No copying required.
From inside WSL:
code .
VS Code opens — using my Windows installation.
What’s happening:
VS Code (Windows UI)
↓
WSL Extension
↓
Linux Environment (runs code)
So:
If I run a server in WSL:
npm start
And it runs on:
localhost:3000
I can open it directly in my Windows browser.
No configuration needed.
This was my biggest confusion.
Clear rule:
Important: Installing something in Linux does NOT make it available in Windows.
They are separate environments.
Docker uses WSL internally, but:
docker-desktop).vhdxDocker Desktop
↓
docker-desktop (WSL distro)
↓
Containers
Ubuntu (your dev environment)
Same project, same folder:
This happens because:
Lesson: Avoid mixing Git operations across Windows and WSL.
Pick one environment.
WSL uses .vhdx files.
Important behavior:
This is why Docker storage suddenly becomes huge.
You need manual compaction to shrink it.
I tried:
su
It failed.
Because:
Correct way:
sudo <command>
At first I thought it’s just for learning Linux commands.
It’s not.
It is useful for:
It replaces:
Now that I understand WSL:
I had this installed for months.
Never used it.
Turns out, it was one of the most useful tools already sitting in my system.
This is Part 1.
Part 2 covers my Git setup and development workflow inside WSL.