Access Local Files from Windows Subsystem for Linux (WSL)
Access Local Files from Windows Subsystem for Linux (WSL)
Accessing local Windows files from a WSL distro can be achieved by navigating to the /mnt/c/ directory in your WSL Linux machine, or you can enter WSL from any Windows directory within a terminal.
This post is to demo both methods described for accessing Windows files from WSL:
# Navigate with cd /mnt/c/
# Open WSL from PowerShell Terminal
You can also create a symbolic link to create a new linked folder between your Windows computer and WSL. Check out my other blog post Create a Link Between Local Windows Files and WSL for more information.
Navigate in Terminal to /mnt/c/
When working within a WSL Linux environment, we can look at the files on our local Windows machine by navigating to the /mnt/
directory as shown in the example below.
# navigate to home (wsl) linux folder cd ~ # navigate c:\temp folder on local windows computer cd /mnt/c/temp
In the Windows Terminal above we are checking the contents of /mnt/
which is the local C & D volumes, and a folder named WSL.
Open WSL from PowerShell Terminal
When working within a PowerShell Terminal, we can open WSL from any Windows directory and the default Linux distribution will be opened with that local Windows-mounted path.
In the example below we’re creating a new folder on Windows within a PowerShell Terminal, navigating into the new folder and then entering WSL.
The PowerShell colours are difficult to see on that path, but it shows the new folder we created within Ubuntu WSL.