Accessing Windows files from Linux
By default, WSL automatically mounts your Windows drives inside WSL distributions (distros). These mounts are created in /mnt
; for example, your C:
drive is mounted as /mnt/c
. To try this out, create a folder called wsl-book
on your C:
drive and place an example.txt
file in it (the contents of the text file don't particularly matter). Now, fire up a terminal in WSL and run ls /mnt/c/wsl-book
, and you will see the file you created listed in the Bash output:
This screenshot includes the directory listing from Windows showing example.txt
in Command Prompt on the left, and the same file listed through the /mnt/c
path in a WSL distro on the right.
You can interact with the mounted files as you would any other file; for example, you can cat
the file to see its contents:
$ cat /mnt/c/wsl-book/example.txt Hello from a Windows file!...