M10A - WSL: The Windows↔Linux Bridge
WSL: The Windows↔Linux Bridge
Learn how to access your Windows files from inside Linux, access your Linux files from Windows Explorer, and run commands across both OSs simultaneously.
- Learn how to access your Windows files from inside Linux, access your Linux files from Windows Explorer, and run commands across both OSs simultaneously.
The Magic of the Bridge
Historically, if you ran Linux on Windows (via a VM), the two systems were completely isolated. You had to set up complex network shares just to copy a text file between them.
The Windows Subsystem for Linux (WSL) destroys that wall. It uses a hypervisor technology that acts as a magical bridge between the two operating systems.
You can see everything. From everywhere.
1. Seeing Windows from Linux (/mnt/c/)
When WSL starts, it automatically mounts your entire Windows C:\ drive into the Linux filesystem.
Remember Model 4 (The Linux Root Tree)? Devices in Linux don’t get drive letters; they get attached to folders.
Open your Ubuntu WSL terminal:
Navigate right into your Windows C: Drive!
cd /mnt/c/
Go to your Windows User folder
cd /mnt/c/Users/YourName/Documents/
List all your Windows files using Linux tools
ls -lah
⚡ Speed Warning
While you can access Windows files from Linux, the translation layer is slow. If you are running an npm install, compiling code, or doing heavy file I/O, do not do it inside /mnt/c/. Always run your code inside the native Linux filesystem (e.g., ~). Only use the bridge for moving files.
2. Seeing Linux from Windows (\\wsl$\)
The bridge goes both ways. Windows maps the entire Linux filesystem to a hidden network path.
Open your Windows PowerShell (or File Explorer):
Navigate right into your Ubuntu root tree!
cd \wsl$\Ubuntu
Go to your Linux home folder
cd \wsl$\Ubuntu\home\yourname\
Explore using Windows Explorer
explorer.exe \wsl$\Ubuntu\home\yourname\
Top Tip: You can open your Linux files in VS Code running on Windows by typing
code .inside your Linux terminal. The WSL extension handles everything automatically.
3. Cross-Execution Wizardry
You aren’t just sharing files. You are sharing compute.
You can run Windows programs from inside the Linux terminal, and you can run Linux commands from inside PowerShell.
Run Linux binaries directly step-by-step from PowerShell:
Run the Linux ‘ls’ command on your Windows desktop
wsl ls -la
Use Linux grep to filter Windows ipconfig output!
ipconfig | wsl grep “IPv4”
Run Windows .exe files step-by-step from inside Ubuntu:
Run a Windows command using cmd.exe
cmd.exe /c “dir”
Open a Windows application (like Notepad) from Linux
notepad.exe /mnt/c/Users/YourName/notes.txt
4. Managing the WSL Engine
Sometimes WSL gets stuck, or consumes too much RAM. You need to know how to manage the invisible virtual machine that powers it.
Run these commands from an Administrator PowerShell prompt on Windows:
See what distributions are running
wsl —list —verbose
Force shutdown the entire WSL engine (Fixes 99% of glitches)
wsl —shutdown
Export your entire Linux environment to a backup file
wsl —export Ubuntu C:\Backups\ubuntu_backup.tar
Import from a backup to create a clone
wsl —import Ubuntu-Clone C:\WSL\Ubuntu-Clone C:\Backups\ubuntu_backup.tar
What You Just Learned
The wall between Windows and Linux is gone.
- Windows
C:\lives at/mnt/c/inside Linux. - Linux root
/lives at\\wsl$\Ubuntuinside Windows. - You can pipe output from a Windows command directly into a Linux command (
ipconfig | wsl grep). - If WSL acts up, open PowerShell and type
wsl --shutdown.
In the next module, we’ll put your entire File System knowledge to the test in a practical lab scenario.