I want to process a file that resides on Windows using WSL. How do I move/copy the file from Windows to the WSL environment?
Linux Distribution installed for WSL: Ubuntu The file is in Desktop.
To copy the file in Windows, right-click on it and select copy: Paste it in the Windows directory where you want to transfer the file. (I have pasted it into the “Documents” directory of Windows.
First, find where your current Windows is mounted within WSL. This will result with $path being a WSL mount path like /mnt/C/Users... Now you can use this variable to run wsl -e to point it to the mounted folder and move files to the native folder structure like `/home/me'.
4 Ways to Transfer Files From Windows to LinuxSecurely copy files via SSH. Windows to Linux file transfer with FTP. Share data using sync software. Use shared folders in your Linux virtual machine.
There are two methods mentioned in this website.
I prefer method 2, so will be summarising this method only.
Open your linux distribution, in my case, it is Ubuntu 20.04 LTS.
I find my file in the following path:
cd /mnt/c/Users/<username>/Desktop
- /mnt/c
is the Windows' C Drive mounted to Linux.
Then copy the file into my WSL's home directory:
cp <filename> ~/
Now go to the WSL's home directory and you can find the file there.
cd ~/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With