linux - 如何在 git bash 终端中打开 wsl 目录

标签 linux windows-subsystem-for-linux

我想打开这个\\wsl.localhost\Ubuntu git bash 终端中的 wsl 目录。我的 git bash 终端当前在 /c/Users/DELL 中打开目录。

我试过\\wsl.localhost\Ubuntu将此命令粘贴到 bash shell 中,但它会抛出错误,指出 bash: \wsl.localhostUbuntu: No such file or directory .

任何人都可以帮我在 git bash 终端中打开它吗?

几天前我设法在 git bash 中打开它,请参阅此图片 enter image description here

但现在我无法这样做,不知道我之前是如何做到的

最佳答案

运行此命令:

cd //wsl.localhost/Ubuntu

命令 \\wsl.localhost\Ubuntu 不起作用,因为

  1. Bash 在解析命令时删除反斜杠(解决方案:使用正斜杠:/)。

  2. 您没有表明要更改当前目录,否则 Bash 会将您的命令解释为按该名称运行外部程序(解决方案:使用 cd 命令)。

关于linux - 如何在 git bash 终端中打开 wsl 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75357281/

相关文章:

linux - Ubuntu 16.04 LTS - 无法在 VIM 中启用 xterm_clipboard

html - 带有VSCode上的Chrome调试器的WSL 2出现ECONNREFUSED错误

ubuntu - 在 WSL 中完全删除 anaconda

bash - 从 Windows 的某个目录中启动 bash

android - 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio

mongodb - 无法更改 mongodb 的 dbpath

linux - grep : can't open/Data. 配置文件

linux - 使用linux命令在文件中的两行之间查找字符串

linux - Shell脚本在多用户环境下运行

linux - 如何在 Linux 内核 3.2.x 中的自定义系统调用期间读取目录的内容