3

by using the command "explorer.exe ." in the Windows Ubuntu WSL terminal it opens the folder which contains all the files of your Windows Subsystem, my question is: Can I use a program installed on Windows like VScode for example and edit a file from the Subsystem?

0
4

Accessing files in Windows Subsystem for Linux (WSL) is officially supported from Windows 10 version 1903 (May 2019). Upgrade Windows 10 before doing this. In older Windows 10 versions, creating and changing Linux files from Windows resulted in losing files or corrupting data.

First, the installed distribution must be started (or initialized) before accessing its files. Because in WSL side, the /init binary implements a Plan 9 server and without the server running, WSL files can't be accessed. Here are the various ways to access WSL Linux distributions files:

  • From WSL, run explorer.exe . command to open WSL files in File Explorer. This will open a File Explorer window, showing the files located inside of your Linux distribution’s filesystem. From here normal edit, copy and paste works.

wsl-distro-home-folder

  • From Windows, the WSL distribution file system is mounted in \\wsl$\ network path. Press Win + R and type that path. All running distribution will be shown as separate folders. Open those to use.

mounted-network-drives

  • Also each network path (that is each mounted filesystem) can be mounted as a separate drive. Right click on the distribution folder name and choose 'Map network drive...' > Choose driver letter (default is Z:\).

mounted-as-a-separate-drive

Further Readings:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.