How to access Windows system files from Ubuntu subsystem Linux terminal

To give native compatibility for Linux operating systems such as Ubuntu, Debian, OpenSuse, Kali and more… Microsoft has added a layer or feature which is known as Windows Subsystem for Linux (WSL). The Windows 10 or 8 users including the latest Windows servers users can activate this feature from the control panel Turn and off windows feature option. The WSL on Windows 10/8 gives us an ability to run a different native command on Linux command-line tools or Bash environment just like a headless server running on some VirtualMachine.

However, we cannot install the Distros ISOs as we do on VirtualBox or any other Virtualization software. Here, what we get is a pre-build headless Linux app available on Microsoft Windows 10 App store. Just go on the store and click on Linux environment app and installed it on the system automatically.

Now after the installation of the Linux environments the thing which comes in mind is that after installing the Linux environment, for example, Ubuntu; where its files get saved by the Windows system. I mean if you want to just access the windows files from the Linux subsystem manually, how would you do that. Plus, is this possible to access the Windows files and drives such as C, D, E… directly from the Ubuntu Linux Subsystem? In this article, we will give answers to these questions…

Note: Until and unless you don’t know what are doing, please refrain yourself from modifying the files of your Linux subsystem manually. It could harm your Linux environment. This is the reason, why Microsoft has stored them in a hidden folder to make sure, the user couldn’t doctor them without knowing actually what he/she is doing?

Helpful related article: How to enable the Windows subsystem for Linux environment feature

How to Access Ubuntu files (windows subsystem) from windows 10

Although we are showing this tutorial using for Ubuntu subsystem, the process will be the same for others too such as OpenSUSE, Kali and more installed on WSL.

The address where Windows 10 WSL store the Linux environment file: %userprofile%AppDataLocalPackages

Step 1: MyComputer

Go to MyComputer and open the C: Drive where all your Windows plus program files are stored.

Local Drive C


Step  2: Show Hidden files and folders

By Default all crucial or core data files and folders in Windows are hidden and we need to unhide them manually. To do this click on the File option given in the menu of Windows Explorer.

From Folder options window click on the View tab and then under the Hidden files and folders select the Show hidden files, folders and drives.

Show Hidden files and folders


Step 3: Access the ubuntu subsystem files from windows 10

Inside the Local Disk C: of the Windows there is folder –Users, click on that.

access Ubuntu subsystem linux files on Windows 10



Step 4: Double click on your Windows username to open it (mine is Raj). After that, open the AppData folder which is basically a hidden folder.

access Windows subsystem Linux files on WIndows 10


Step 4: Inside the AppData open the Local->Packages->ConicalGroupLimited folder for Ubuntu. In the same way for other Linux environments, it will start with their names.

locate the Linux Ubuntu files on WIndows 10 subsystem linux WSL


Step 5: Inside the folder double click to open the LocalState->rootfs. All the files and folders of Ubuntu Linux environment will show there.

all the files and folders of Ubuntu

Now click on the Home folder where you will find the UNIX username.


How to access Windows files from Ubuntu terminal

To access all Windows 10 system drives under the Command Terminal of Ubuntu or other Linux environment installed on Windows; we need to follow the mounting command of Linux.

By default, we can only use the Bash environment to access Windows files as we do in the Ubuntu/Linux headless servers.

From your Linux Bash Shell type following command to mount C: Drive:

cd /mnt/c
ls

In the same way for D: drive type 

cd /mnt/d
ls

In this way, we can also mount both internal and external drives attached to our Windows 10 or 8 systems including the network drives. Also, one thing to be noted that the Bash Shell of Linux environment should be launched under the Administrative right to access the system folders of Windows. To give administrative permission just right click on the installed Linux environment such as Ubuntu and select “Run as Administrator”.

Other Useful Resources 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.