By Chris Hoffman on July 6th, 2016
Windows 10’s “Bash on Ubuntu on Windows” environment contains a few different components. The first time you run the bash.exe program, it will download and install an entire Ubuntu user space environment. You can access these files in File Explorer or other Windows programs, if you know where to look.
You can also access your Windows system drive–and any other drives on your computer–from within the Ubuntu Bash shell. This allows you to work with your normal Windows files using Linux command-line utilities.
Where the Ubuntu Bash Shell Files Are Stored in Windows
Note that each Windows user account that uses Bash will have its own separate Bash environment and files under its own user directory.
To access these files, you’ll first need to show hidden folders in File Explorer. Open a File Explorer window and click View > Options > Change Folder and Search Options.
In the Folder Options window that appears, select View > Show Hidden Files, Folders, and Drives.
Navigate to the following directory to find these folders:
The Ubuntu system files are stored at:
Your Ubuntu user account’s home folder is stored at:
The root account’s home folder is stored at:
Where Your Windows System Drive Appears in Bash
The Ubuntu Bash shell environment makes your full Windows system drive available so you can work with the same files in both environments. However, the Bash environment doesn’t just dump you in your C:\ drive. Instead, it places you in /, or the root directory you’d have on Linux. If you perform an
ls command to view the contents of the directory, you’ll just see the Ubuntu directories that provide the Linux environment.
Your Windows system drive and other connected drives are exposed in the /mnt/ directory here, where other drives are traditionally made available in the Linux directory structure. Specifically, you’ll find the C: drive at the following in the Bash environment:
To change to this directory with the “cd” command, run the following command:
If you have a D: drive, you’ll find it located at /mnt/d, and so on.
For example, to access a file stored at C:\Users\Chris\Downloads\File.txt, you’d need to use the path /mnt/c/Users/Chris/Downloads/File.txt in the Bash environment.
Note that, when accessing Windows system files, your Bash shell environment has the permissions it was launched with. If you launched it normally from the shortcut, it will have the same file access permissions your Windows user account does.
For example, if you want to access the C:\Users\Administrator folder, you’d need to right-click the Bash shell shortcut and select “Run as Administrator” to launch the Bash shell with Windows Administrator privileges.
This works just like the Command Prompt, which needs to be launched as Administrator if you need write access to Administrator-only files, or write access to system files. You can’t just use “sudo” in the Bash environment.