Instructions for accessing Ubuntu Bash files on Windows
The 'Bash on Ubuntu' environment on Windows' of Windows 10 contains several different components.
The first time you run the bash.exe program, it will download and install an entire Ubuntu environment. You can access files in File Explorer or other Windows programs, if you know the search location.
You can also access your Windows system drive and any other drive on your computer from the Ubuntu Bash Shell. This allows you to work with normal Windows files using the Linux command utility.
1. Where are the Ubuntu Bash Shell files stored on Windows?
Note, each Windows user account using Bash will have a separate Bash environment and files in the directory.
To access these files, you must first set up the display of hidden folders on File Explorer.
Open the File Explorer window, then click View => Options => Change Folder and Search Options .
On the Folder Options window, select View => Show Hidden files, Folders and Drivers .
Navigate following the path below to find the directory:
C: UsersUSERNAMEAppDataLocallxss
Ubuntu system files are stored at:
C: UsersUSERNAMEAppDataLocalLxssrootfs
The Ubuntu account directory of the main user is stored at:
C: UsersUSERNAMEAppDataLocalLxsshomeUSERNAME
The main Root account directory is stored at:
C: UsersUSERNAMEAppDataLocalLxssroot
2. Location of Windows system drive on Bash
The Ubuntu Bash Shell environment makes your entire Windows system available to work with the same files on both environments.
However, the Bash environment does not appear in the C: drive. Instead, it is placed in / or the root directory you have on Linux. If you perform a ls command to view the contents of the directory, you will only see Ubuntu directories that provide the Linux environment.
On the Windows system drive and other connections in the / mnt / directory - the location of other drives is available on the Linux directory structure.
In particular, you'll find drive C according to the path below in the Bash environment:
/ mnt / c
To change this directory with the cd command, run the following command:
cd / mnt / c
If you have a D: drive, you will find the D: drive in / mnt / d.
For example to access files stored in C: UsersChrisDownloadsFile.txt , you use the path /mnt/c/Users/Chris/Downloads/File.txt in the Bash environment.
Note that, when you access Windows system files, your Bash Shell environment must have repository permissions to run those files. If you launch the file in the usual way from the shortcut, it will have access to the file with your Windows user account.
For example, if you want to access the C: Users folder of the Administrator folder , you must right-click the Bash shell shortcut and select "Run as Administrator" to start the Bash Shell with Admin rights on Windows.
This process works similarly to the Command Prompt, it needs to start under Admin if you want to write, access Admin rights - only files, or write access to system files. Also, you cannot use sudo on a Bash environment.
Refer to some of the following articles:
- Ubuntu Bash tutorial on Windows 10
- Instructions for managing programs in Ubuntu via the command line
- How to enable automatic system update mode on Ubuntu
Good luck!
You should read it
- Ubuntu Bash tutorial on Windows 10
- How to change user accounts in Ubuntu Bash Shell Windows 10
- Everything you can do with the new Windows 10 Bash Shell
- How to Install and Run Bash on Windows 11
- How to create and open folders in VS Code with Git Bash for Windows
- Shortcuts to copy - paste coming soon on Windows 10's Bash Console
- How to use Zsh (or other Shells) on Windows 10?
- Running Linux on Windows 10 does not require a virtual machine, here are 18 things you should know
- How to simplify 7z file compression with Bash Alias
- Tips and tricks after installing Ubuntu
- Difference between Zsh and Bash
- How to Install Windows from Ubuntu