Have you ever wondered where exactly WSL (Windows Subsystem for Linux) resides on your computer? If you’re a developer or tech enthusiast using WSL to run Linux distributions in your Windows environment, understanding where and how WSL is stored can be particularly helpful for troubleshooting, backup, or performance tuning purposes. In this article, we’ll take a closer look at where WSL lives within your Windows system and explore some of the hidden aspects of its architecture.
What is WSL?
WSL, or Windows Subsystem for Linux, is a compatibility layer developed by Microsoft that allows Linux executables to run natively on Windows. It creates an environment in which users can run a full-fledged Linux distribution, such as Ubuntu or Debian, without the need for dual-booting or using a virtual machine.
With WSL 2, Microsoft introduced a complete Linux kernel running in a lightweight virtual machine, offering improved performance and compatibility.
So, Where is WSL Actually Located?
The location of WSL files mainly depends on whether you are using WSL 1 or WSL 2. Let’s break it down:
WSL 1 File Location
In WSL 1, Linux distributions are stored as simple files under your user directory. The file system is implemented within the Windows NT file system itself.
- Each Linux distribution is installed into a specific folder located here:
C:\Users\<YourUsername>\AppData\Local\Packages
- Inside this folder, look for a directory that corresponds to your Linux distribution. For example, Ubuntu might be under something like:
CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
- In this folder, the Linux filesystem is typically located inside a folder called
LocalState\rootfs
.
This folder contains all of your files, including the familiar Linux directory structures like /bin, /etc, /home, and so on.

WSL 2 File Location
Things change a bit with WSL 2. Since it runs a virtual machine, it uses a virtual hard disk to store all your files. This VHD (Virtual Hard Disk) represents your entire Linux filesystem.
- You can find it at a path like this:
C:\Users\<YourUsername>\AppData\Local\Packages\<Your-Distribution-Folder>\LocalState\ext4.vhdx
- This file is the entire VM disk, containing all your Linux files and directories.
- To access it, you generally use WSL itself, but with some effort, you can also mount it manually in Windows.
Important: You should not attempt to alter or move the ext4.vhdx
file directly unless you really know what you’re doing — doing so could corrupt your Linux environment.
Accessing Linux Files Directly from Windows
Sometimes you might want to access your WSL files from Windows File Explorer. Fortunately, Windows makes this simple with a friendly path:
Open File Explorer and enter the following in the address bar:
\\wsl$
This special path lets you browse all running WSL distributions and their Linux file systems. Each distribution appears as a separate folder.

This feature is especially helpful if you want to copy files between Windows and Linux environments without using the terminal.
Moving or Backing Up WSL Data
Since WSL 2 uses a VHDX file, you can back it up by copying this file to another location. Microsoft also provides commands to export and import WSL distributions, which is safer and more robust for backup purposes:
wsl --export <DistroName> <Filename.tar>
wsl --import <NewDistroName> <InstallLocation> <Filename.tar>
Using these commands ensures your WSL setup can be safely transferred or archived for future use.
Takeaway
Whether you’re using WSL 1 or WSL 2, understanding where your Linux environment lives on your computer can unlock new ways to interact with, back up, or troubleshoot your setup. From AppData folders to VHDX files and the handy \\wsl$\
shortcut, knowing how WSL fits into your Windows file system helps you make the most of this powerful tool.
Next time you launch your Linux shell on Windows, you’ll know exactly where the magic is happening beneath the surface.