📅 2019-Jun-13 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ path, wsl ⬩ 📚 Archive
Windows Subsystem for Linux (WSL) allows you to install Linux distributions such as Ubuntu under Windows and use them just like using a native Linux system using a Linux shell. Sometimes, I find it useful to access the files and directories that are in the WSL-Linux from Windows Explorer outside. The root filesystems of the Linux installations inside WSL can be viewed and accessed through Windows Explorer. You can even pin this root filesystem (or any subdirectory) inside Windows Explorer if you like to access it frequently.
Do note that the paths where this root filesystem appears in Windows has changed between WSL1 and WSL2 (see below). Other caveats include simultaneous read-write of files between Windows and WSL can be flaky, so can writing a WSL file from Windows.
The root filesystems of your Linux installations in WSL2 appear under \\wsl$
in Windows Explorer.
For example:
\\wsl$\Ubuntu-22.04
\\wsl$\Ubuntu-20.04
The root filesystem you see under WSL is located at a directory inside %LOCALAPPDATA%
in Windows.
For example:
%LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs
%LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs