-
Book Overview & Buying
-
Table Of Contents
Windows Subsystem for Linux 2 (WSL 2) Tips, Tricks, and Techniques
By :
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:
Figure 5.1 – A screenshot showing listing folder contents from Windows and WSL
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!...