How to Access Windows Files from Ubuntu Terminal in Windows 10 and Vice Versa

HomeWindowsHow to Access Windows Files from Ubuntu Terminal in Windows 10 and...

How to Access Windows Files from Ubuntu Terminal in Windows 10 and Vice Versa

In 2016, Microsoft released WSL (Windows Subsystem for Linux) to allow Linux users to run native Linux commands via a Linux terminal installed on the Windows system. This feature is available for Windows 10 and Windows 8 with the Linux terminal app can be installed via Microsoft Store.

A big question after installing a Linux terminal on Windows 10 maybe is how to access the Windows 10 files from the Linux terminal and vice versa, how to access Linux files from Windows.

Although we will use Ubuntu as an example in this article, you can also use the same methods on other Linux distribution such as Suse, Kali Linux, and so on.

How to access Windows files from the Ubuntu terminal in Windows 10

If you are already familiar with the Linux commands then you should not meet any problem to access Windows files from the Ubuntu terminal. To access Windows files, you need to mount the drive in which the files you want to access are stored in. Well, all Windows drives are basically have been mounted in the /mnt folder so you can simply go to this folder to access the Windows files. You can use the cd command to go to the /mnt folder.

cd /mnt/

And use the ls command to see the list of the drives existing on your Windows system.

Again, you can use the cd command to enter to one of the existing drives. For instance, if you want to enter to drive D, you can simply type cd d in the /mnt folder. You can use the pwd command to figure out in what folder you are currently in.

If you want to access files on the external drives (i.e flash drive), you need to manually mount the drive since Windows doesn’t automatically mount the external drives on the Linux terminal. Here are the steps.

  • Find the drive location. You can do so from File Explorer.
  • Create a new folder in the /mnt folder using the mkdir command. You need this folder to mount your drive.
mkdir g
  • Say your flash drive is located in the drive G, type the following command to mount it.
sudo mount -t drvfs G: g

The command above will mount your flash drive, which located in drive G, to the g folder on the /mnt folder. The sudo prefix indicates you run the command as root. Use the cd command to enter to the g folder.

How to access the Ubuntu files from Windows

All files and folder you created on the Ubuntu Subsystem (as well as the Ubuntu Subsystem files and folders) are stored in Windows 10, but they are hidden by the Windows system by default. To access them, you need to enable the Hidden files option on File Explorer. To do so, click the View menu and tick the Hidden files option.

The files of your Ubuntu Subsystem are located on the following path.

C:\Users\your user profile\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs

hand-picked weekly content in your inbox


related posts


Please enter your comment!
Please enter your name here