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). 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 the 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 to the store and click on the Linux environment app and installed it on the system automatically.
Now after the installation of the Linux environments, the thing which comes to 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, and 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 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 stores the Linux environment file: %userprofile%\AppData\Local\Packages
Step 1: MyComputer
Go to MyComputer and open the C: Drive where all your Windows plus program files are stored.
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 the Folder options window click on the View tab and then under the Hidden files and folders select Show hidden files, folders, and drives.
Step 3: Access the Ubuntu subsystem files from Windows 10
Inside the Local Disk C: of the Windows, there is a folder –Users, click on that.
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.
Step 4: Inside the AppData open the Local->Packages->ConicalGroupLimited folder for Ubuntu. In the same way as other Linux environments, it will start with their names.
Step 5: Inside the folder double click to open the LocalState->rootfs. All the files and folders of the Ubuntu Linux environment will show there.
Now click on the Home folder where you will find the UNIX username.
How to access Windows files from the Ubuntu terminal
To access all Windows 10 system drives under the Command Terminal of Ubuntu or another Linux environment installed on Windows; we need to follow the mounting command of Linux..
From your Linux Bash Shell type the 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 11 systems including the network drives. Also, one thing to be noted is that the Bash Shell of the 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