To access Windows files, such as reading or writing, you can prefix the Windows drive path as shown in this guide.
Ubuntu WSL works inside the Windows system for Linux, so you must supply a Linux-compatible path to your commands.
The primary difference between Linux and Windows file-system hierarchy
If you understand the fundamental differences between the two Operating systems’ file navigation, you can do it your own next time!
- In Windows, your file navigation starts with the drive – column – then backward slash and backward slashes to represent the directory level.
- Linux path starts with forwarding slash, and forward slashes to separate directory hierarchy.
- Windows file systems are, by default, visible to WSL Linux (I have tested this in Ubuntu WSL).
- They appear like mounted file-system and can be accessed by starting /mnt/<drive-name>
For example, I am navigating to a Windows folder on my Desktop:
Here is a screenshot showing all the steps we have discussed.
Double-quote the entire PATH to navigate if your Windows path contains a space character. For instance, here is how you can access the New folder, which is on the desktop and has white space in its name:
cd "/mnt/c/Users/dev/Desktop/New folder"
Note: dev is the windows username for my laptop. You have to use your Windows username instead of this. What is the Navigation difference between Windows and Linux absolute PATH?
To conclude, we have covered the steps on how to access windows files from an Ubuntu terminal WSL