我在 bash 中看不到 windows 的粘贴文件
I can't see pasted files in bash for windows
我正在学校进行一个编程项目,并决定尝试 Bash 以达到 windows。我下载了该项目的框架文件并将它们粘贴到我的 bash 主文件夹所在的文件夹中。当我打开终端并进入文件夹时,它显示好像那里什么也没有,即使我在正确的文件夹中。我怎样才能让文件显示出来?
不清楚你在问什么。你贴了什么?整个文件?文本?你把它贴在哪里了?您是否粘贴到 bash window?如果是这样,它是在文本文件中还是只是粘贴到提示符处?我将假设您将文件粘贴到您认为 bash 主页打开的目录,即 ~/
。您可能没有将文件粘贴到正确的目录中,因为 windows 上的 bash 的默认目录不是您认为的目录。您应该可以通过键入 cd /mnt/c/Users/yourUserNameHere/Desktop
来访问您的桌面
编辑: 到目前为止,实际上有一种受支持的方式来访问这些文件。您必须使用 \wsl$\Legacy
"network" 共享。例如,您可以使用 \wsl$\Legacy\home\<username>
访问 Windows 中的 WSL 主文件夹。不过,您应该不直接访问 lxss 目录。
You are not supposed to touch the LXSS folder ever. 那里的文件使用普通 Windows 应用程序无法理解的特殊属性来提供 NTFS 本身无法提供的完整 Linux 文件系统的功能'不提供。
There is one hard-and-fast rule when it comes to Bash on Windows:
DO NOT, under ANY circumstances, create and/or modify Linux files
using Windows apps, tools, scripts, consoles, etc. Creating/changing
Linux files from Windows will likely result in data corruption and/or
damage your Linux environment requiring you to uninstall & reinstall
your distro! Note: Your “Linux files” are any of the files and folders
under %localappdata%\lxss – which is where the Linux filesystem –
distro and your own files – are stored on your drive
如果要将文件复制到不在/mnt
下的WSL目录中,则使用WSL复制文件,例如使用cp /mnt/c/original/folder/of/the/file.txt ~/
。
一种更高级的替代方法是在 WSL 中启动本地 SSH 服务器并使用 Win-SSHFS 将 WSL 根目录作为驱动器安装在 Windows 中。这样,文件访问将通过 WSL。
我正在学校进行一个编程项目,并决定尝试 Bash 以达到 windows。我下载了该项目的框架文件并将它们粘贴到我的 bash 主文件夹所在的文件夹中。当我打开终端并进入文件夹时,它显示好像那里什么也没有,即使我在正确的文件夹中。我怎样才能让文件显示出来?
不清楚你在问什么。你贴了什么?整个文件?文本?你把它贴在哪里了?您是否粘贴到 bash window?如果是这样,它是在文本文件中还是只是粘贴到提示符处?我将假设您将文件粘贴到您认为 bash 主页打开的目录,即 ~/
。您可能没有将文件粘贴到正确的目录中,因为 windows 上的 bash 的默认目录不是您认为的目录。您应该可以通过键入 cd /mnt/c/Users/yourUserNameHere/Desktop
编辑: 到目前为止,实际上有一种受支持的方式来访问这些文件。您必须使用 \wsl$\Legacy
"network" 共享。例如,您可以使用 \wsl$\Legacy\home\<username>
访问 Windows 中的 WSL 主文件夹。不过,您应该不直接访问 lxss 目录。
You are not supposed to touch the LXSS folder ever. 那里的文件使用普通 Windows 应用程序无法理解的特殊属性来提供 NTFS 本身无法提供的完整 Linux 文件系统的功能'不提供。
There is one hard-and-fast rule when it comes to Bash on Windows:
DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc. Creating/changing Linux files from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro! Note: Your “Linux files” are any of the files and folders under %localappdata%\lxss – which is where the Linux filesystem – distro and your own files – are stored on your drive
如果要将文件复制到不在/mnt
下的WSL目录中,则使用WSL复制文件,例如使用cp /mnt/c/original/folder/of/the/file.txt ~/
。
一种更高级的替代方法是在 WSL 中启动本地 SSH 服务器并使用 Win-SSHFS 将 WSL 根目录作为驱动器安装在 Windows 中。这样,文件访问将通过 WSL。