How to Access Your Ubuntu Bash Files in Windows (and Your Windows System Drive in Bash)

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 1

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.

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 2

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.

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 3

Navigate to the following directory to find these folders:

C:\Users\USERNAME\AppData\Local\lxss

The Ubuntu system files are stored at:

C:\Users\USERNAME\AppData\Local\Lxss\rootfs

Your Ubuntu user account’s home folder is stored at:

C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME

The root account’s home folder is stored at:

C:\Users\USERNAME\AppData\Local\Lxss\root

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 4

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.

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 5

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:

/mnt/c

To change to this directory with the “cd” command, run the following command:

cd /mnt/c

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.

how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash photo 6

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.

Article How to Access Your Ubuntu Bash Files in Windows (and Your Windows System Drive in Bash) compiled by Original article here

More stories

How to Reverse a Numbered or Bulleted List in Microsoft Word

You’ve created a really long list of items in Word, and now discover you need to reverse the order. Do you manually move each item? Luckily, no. We’ll show you a trick for reversing a list in Word that works on numbered and bulleted lists.

How to See Previous Logon Information on the Windows Sign In Screen

By default, most versions of Windows record an event every time a user tries to log on, whether that log on is successful or not. You can view this information by diving into the Event Viewer, but there’s also a way to add information about previous logons right on the sign in screen where you can’t

How to Control Your PlayStation 4 with Your Smartphone

Sony’s official PlayStation app, available for both Android phones and iPhones, allows you to remotely control your PS4. Use it as a playback remote or a keyboard for quickly typing without relying on the PS4’s controller and on-TV keyboard.

How to Set Up an Amazon Dash Button

Amazon already makes it really easy to order stuff with its 1-Click ordering system, but the company’s relatively new Dash buttons make ordering stuff even easier. Here’s how to set one up quickly and easily.

How to Create a PDF File on a Mac

Creating a PDF file on a Mac is really easy, and you can quickly and easily convert virtually any document to PDF or create one from scratch.

How to See a List of Songs You’ve Identified Using Siri

Siri can make use of the Shazam engine to identify songs it hears, which is pretty useful–especially if you’re using Siri hands-free.. Unfortunately, you can’t just ask Siri to show you a list of a songs you’ve identified. For that, you have to dive into the iTunes app or, for a more complete list,

How to Play SteamVR Games (and Other Non-Oculus Apps) on the Oculus Rift

The Oculus Rift is locked down by default, and will only run games and apps from Oculus’s own store. You’ll see an “Unknown Source” message on the Rift if you try to run something else. But change one setting, and you can use Valve’s SteamVR or any other Rift-enabled app or game.

How to Get Rid of “Suggested Apps” in Windows 10

In the Windows 10 Fall 2015 update, Microsoft introduced what they call the “Microsoft Consumer Experience”, which includes some rather annoying “suggestions” in the Start menu–both on the left side, under your apps, and on the right side as live tiles.