将文件从 Windows 复制到适用于 Linux 的 Windows 子系统 (WSL) [英] Copy Files from Windows to Windows Subsystem for Linux (WSL)
问题描述
我已启用开发者模式并在 Windows 上安装了 Bash on Ubuntu
.
I have enabled developer mode and installed Bash on Ubuntu on Windows
.
我的主目录可以在 %localappdata%Lxsshome<ubuntu.username>
下找到,我创建了一个名为 Pictures 的子目录,因此完整路径应该是
My home directory can be found under %localappdata%Lxsshome<ubuntu.username>
, i have created a sub-directory called Pictures such that the full path should be
在 Windows 上:C:Users
on windows: C:Users<windows.username>AppDataLocallxsshome<ubuntu.username>Pictures
在 bash 上:/home/
如果我使用命令 touch hello.txt
从 bash 创建一个文件,我可以在 Windows UI 中自由地看到这个文件并将它复制到我的桌面.但是,如果我从 Windows UI 创建一个新的文本文件并将其保存在 C:Users<windows.username>AppDataLocallxsshome<ubuntu.username>Pictures
,即使我重新启动 bash 或 windows,当我执行 ls -l
时文件也不可见.
if i create a file from bash using the command touch hello.txt
i can freely see this file in the windows UI and copy it to my Desktop. However, if i create a new text file from the windows UI and save it in C:Users<windows.username>AppDataLocallxsshome<ubuntu.username>Pictures
, even if i restart bash or windows, the file is not visible when i do ls -l
.
为什么 bash 不能在它自己的主目录中看到从 Windows 端创建的文件?
Why can't bash see files created from the Windows side in it's own home directory?
EDIT 使用 /mnt/c
不是解决方案,我想了解 为什么 它看不到这些文件,如果对此有一个补救措施,它可以看到 UI 创建的文件,而不是尝试使用终端复制粘贴或移动文件.
EDIT Using /mnt/c
is not a solution, i am trying to understand why it doesn't see those files and if there is a remedy to that so that it will be able to see UI created files, rather than trying to use the terminal to copy-paste or move files over.
推荐答案
你应该可以在/mnt
目录下访问你的windows系统.例如在 bash 中,使用它来访问您的图片目录:
You should be able to access your windows system under the /mnt
directory. For example inside of bash, use this to get to your pictures directory:
cd /mnt/c/Users/<ubuntu.username>/Pictures
希望这会有所帮助!
这篇关于将文件从 Windows 复制到适用于 Linux 的 Windows 子系统 (WSL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!