Whenever I try to login to bash using the Windows Subsystem for Linux, I try to cd into C:\Users\, but all I get is directory not found.

Where is the C drive for the Windows Linux subsystem? Is it isolated?


Solution 1:

Taken from this website:

The WSL has access to your PC’s file system through /mnt/<drive letter>/ directories (or mount points). For example, your C:\ and D:\ root directories in Windows would be available through /mnt/c/ and /mnt/d/ respectively in the WSL

Just cd into the /mnt folder and you'll be fine

Solution 2:

/mnt/c or /mnt/<drive letter>/

you’ll find your local drives mounted under the /mnt folder.
For example, your C: drive is mounted under /mnt/c [msdn]

The Linux filesystem is a unique tree (there are no C:\, D:\ ...).
The root of this tree is / (note / not \).

All the units – partitions, pen drives, removable disks, CD, DVD – will be available when mounted on a point of this tree. Then you will see them as normal directories.

The usual place where the additional partitions are mounted is the /mnt directory.
This works under the Windows Linux Subsystem too.

Note: Under Linux, you've got to use the slash (/) instead of the backslash (\) to separate the directories in a path. And usually a Linux filesystem is case sensitive (mydir and Mydir are two different things).

Solution 3:

Since the days of Windows NT, there has been another way to access drives. Instead of using a letter, you can bind a drive to a folder in the filesystem. Microsoft calls these mounted folders. As far as the end user is concerned, they work just like normal folders do: they happen to reside on another drive, but under most circumstances you don't notice. This can be useful in a number of scenarios, but it turns out to be critical if you happen to have so many drives mounted that you run out of drive letters, but need to add even more: mounted folders are how you can do that.

In Linux (and Unix, which inspired it), all drives work this way. There is only one filesystem, which starts at the empty path / (and is typically bound to a drive), and then you mount your other drives (or, sometimes, other things) using directories inside /. These are called mount points in Unix terminology (which Linux inherited). For example, user home directories are often in /home/username, but it's common to make /home a mount point for another drive entirely. That way if the drive you boot from fails for some reason, your home directories aren't affected. The users just go to /home/username like they always do; unless they're responsible for maintaining the machine, they don't have to know or care what drive their home directories are on.

The WSL tries to imitate Linux, so it does this too. To bridge the gap, it mounts your Windows drives in the folder '/mnt/', using the drive letter as the directory name. Your C: drive, for example, can also be found at /mnt/c, while your D: drive is at /mnt/d.