Windows 10’s April 2019 Update brings a long-awaited feature: Support for easily accessing, viewing, and even modifying Windows Subsystem for Linux (WSL) files from File Explorer or via the command line.
Previously, it was possible to find your Linux files in your AppData folder, but Microsoft warns against that. Modifying files here would break things. Now, there’s an easier, official way to access these files with Windows tools—without the risk of breaking anything!
Microsoft’s Craig Loewen explains how it works: Rather than accessing these files directly, Windows runs a Plan 9 server as part of the WSL software in the background. Windows 10 has “a Windows service and driver that acts as the client and talks to the Plan9 server.” That server translates your file operations and handles Linux metadata such as file permissions, ensuring everything works properly even when you access a file with a Windows tool. But that’s just the complicated stuff that happens in the background, and you don’t have to think about it.
You can open a File Explorer window directly in the current directory from within a Linux shell environment. Just type the following command into the Bash shell:
You can work with files normally from here. Use drag and drop, copy and paste them, or even open them directly in Windows applications to modify them.
Microsoft may change how this works in the future. But, for now, you can also type following path into an Explorer window to access a Linux distribution’s files:
In other words, if you’re running Ubuntu 18.04’s Bash shell, you’d type:
This also works from the command line, of course. In PowerShell or the Command Prompt, the command
cd \\wsl$\Debian\ changes to the root directory of your installed Debian system.
Windows Subsystem for Linux users have wanted this feature for a long time. Back in 2016, Microsoft’s Rich Turner wrote that he had to warn people not to access their Linux files in File Explorer at least two or three times per day. Now, there’s finally a way to work with these files without the risk of breaking something.