Accessing the WSL Filesystem from Windows

Just a quick one this time! I use Windows editors but compile using WSL2. For more information about WSL2, see Linux on Windows in 2021.

When you want to access your WSL files from Windows, there’s a really handy shortcut you can use:

  • Type [Windows Key+R] to open the run dialog.
  • Type “\\wsl$” and hit [enter]

You will now see all your Linux distributions listed. Not only that, but you can also map each distro as a network drive:

  • Right Click on one of the listed Linux distro’s (default is “Ubuntu”)
  • Click on “Map Network Drive”.
  • From the dialog box that opens, select a drive letter (I chose “u:”) and hit OK.

You can now just hit [Windows Key] + R, type “u:” and you have access to your Linux distro through the Windows file system! This is a boon when you are accessing files from both OSes. “U:” will also be listed as a normal drive in File Explorer!