windows - 我在 bash for windows 中看不到粘贴的文件

标签 windows bash terminal windows-subsystem-for-linux

我在学校从事一个编程项目,并决定尝试一下 Bash for windows。我下载了该项目的框架文件并将它们粘贴到我的 bash 主文件夹所在的文件夹中。当我打开终端并进入文件夹时,它显示好像那里什么也没有,即使我在正确的文件夹中。如何让文件显示出来?

最佳答案

编辑:到目前为止,实际上有一种受支持的方式来访问这些文件。你必须使用 \\wsl$\Legacy “网络”共享。例如,您可以使用 \\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。

关于windows - 我在 bash for windows 中看不到粘贴的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41704972/

相关文章:

linux - 终端错误 : cp: illegal option

java - 在 Cubieboard 平台内运行的 Java 代码中执行终端命令获取输出

windows - ffmpeg 解码 h.264 流延迟总是一帧

java - 使用Java应用程序模拟NTFS/FAT分区

windows - 如何生成字符串类型ID的资源条目?

linux - 自动执行命令的本地Linux用户无法关闭

linux - 使用文字双引号从 bash 脚本生成文本

c++ - 在 Windows 中通过 C++ 更改另一个程序的变量

macos - 将字符串读入变量,直到 BASH 中的某个单词

c - 转到一行并更改为大写