Today we are going to discuss about how to copy file from your Windows 10 machine to Windows Sub-System for Linux.
Distribution Package of Windows Sub-System for Linux
First thing first, before you can even begin you have to understand where all the Linux files are placed in your Windows 10 machine. To avoid any accidental tampering Microsoft stores all you Linux files under the following hidden folder:
%userprofile%\AppData\Local\Packages
Here you can find your Linux distribution packages (distro) , double-click on the folder for your distribution, following is name of distribution package and folder name mapping:
Distribution Package | Folder Name |
---|---|
Ubuntu | CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc |
openSUSE Leap 42 | 46932SUSE.openSUSELeap42.2_022rs5jcyhyac |
SUSE Linux Enterprise Server 12 | 46932SUSE.SUSELinuxEnterpriseServer12SP2_022rs5jcyhyac |
For Ubuntu which I’m using, I’ll look for CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc and then navigate to folder navigate to .\LocalState\rootfs\
folder. This is the root file share where all you files are placed
Copy Files
Method 1 – Manual Copy-Paste
You can simply move or copy-paste files inside one of these Linux directories,
but the files won’t appear in you Windows Sub-system for Linux Bash Shell until you restart it.
Method 2 – Windows System Drive as a Mount point
Windows Sub-System for Linux provides you access to the Windows 10 system drive by mounting the C:\
. On Linux if you go to you root directory and list all directories, then you will notice a /mnt/c/
which is Windows 10 C:\
mounted on Linux
Now simply use copy command ( cp
) to copy files over to your Linux Subsystem.
Video Tutorial
If you like this article read more similar articles under ‘N – Ways to’ category
- 4 ways to send output to NULL in PowerShell
- 3 ways to store and display PowerShell Variable simultaneously
- 4 ways to select Unique items in PowerShell
- 4 Ways to Create PowerShell Objects
- 4 Ways to Find OS Architecture using PowerShell (32 or 64 bit)
My New Book : PowerShell Scripting Guide to Python
This PowerShell Scripting guide to Python is designed to make readers familiar with syntax, semantics and core concepts of Python language, in an approach that readers can totally relate with the concepts of PowerShell already in their arsenal, to learn Python fast and effectively, such that it sticks with readers for longer time.
“Use what you know to learn what you don’t. ” also known as Associative learning.
Book follows a comparative method to jump start readers journey in Python, but who is the target audience? and who should read this book –
- Any System Administrator who want to step into Development or Programming roles, and even if you don’t want to be a developer, knowledge of another scripting language will make your skill set more robust.
- Python Developers who want to learn PowerShell scripting and understand its ease of user and importance to manage any platform.
Python is one of the top programming languages and in fast changing IT scenarios to DevOps and Cloudto the future – Data Science, Artificial Intelligence (AI) and Machine Learning Python is a must know.
But this PowerShell Scripting guide to Python would be very helpful for you if you already have some knowledge of PowerShell
NOTE! This is a Leanpub “Agile-published” book. That means the book is currently unfinished and in-progress. As I continue to complete the chapters, we will re-publish the book with the new and updated content. Readers will receive an email once a new version is published!
While the book is in progress, please review it and send any feedback or error corrections at prateek@ridicurious.com
Prateek Singh
Related posts
10 Comments
Leave a ReplyCancel reply
Categories
Author of Books
Awards
Open Sourced Projects
Author at
Blog Roll
Mike F RobbinsDamien Van Robaeys
Stéphane van Gulick
Kevin Marquette
Adam Bertram
Stephanos Constantinou
Francois-Xavier Cat
Ravikanth Chaganti
Roman Levchenko
Blog Stats
- 1,132,570 People Reached
Thanks for the guide. I imagine this procedure is new because previous Windows 10 did not allow directly copying and pasting from Windows environment.
Furthermore, in our Windows version we just have
Packages\CanonicalGroupLimited.xxxx\LocalState\rootfs\root\ourusername
We don’t have the home directory that you mentioned.
Can we still copy and paste directly from Windows?
Hi Prateek,
Love the series ‘X ways to . . .’
Just want to mention, Method 1 above should come with a warning . . .
https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
Best regards,
Michael
Wish I had seen this before following this article! It would have saved me a headache. To anyone reading this, method 1 in this article doesn’t work and can cause all kinds of problems for you. Refer to MiMaher’s link above, which was published 2 years before this article and warns in big red letters: “DO NOT, under ANY circumstances, access, create, and/or modify Linux files inside of your `%LOCALAPPDATA%` folder using Windows apps, tools, scripts, consoles, etc.”
[…] 2 Ways to Copy Files from Windows 10 to Windows Sub-System for Linux […]
Thanks, very helpful.
Thanks Prateek, You’ve made my day.
ok, this is great.
But I still have a question regarding permissions. If I edit a file with notepad++ and I save it (using nopad++) in a linux reposetory, I cant execute the file because of a “permisions denied” alert, even if I have alerady changed it before.
Do you have any tips for that?
Helped me a lot! Great guide 🙂
thanks was helpful
This just solved a problem I have been working on for days. How to move files from a Windows download directory into the Ubuntu WSl file system directory. Thanks, you da Man!