如何在Git Bash终端中打开WSL目录

huangapple go评论61阅读模式
英文:

How to open a wsl directory in git bash terminal

问题

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

我尝试在bash shell中粘贴\\wsl.localhost\Ubuntu这个命令,但它会抛出错误,显示bash: \wsl.localhostUbuntu: No such file or directory

有人可以帮我在git bash终端中打开吗?

几天前我成功地在git bash中打开了它,看这个图片
如何在Git Bash终端中打开WSL目录

但现在我无法做到,不知道我之前是如何成功做到的。

英文:

I want to open this \\wsl.localhost\Ubuntu wsl directory in git bash terminal. My git bash terminal is currently open in /c/Users/DELL directory.

I tried \\wsl.localhost\Ubuntu pasting this command in the bash shell, but it throws error saying that bash: \wsl.localhostUbuntu: No such file or directory .

Can anybody help me opening that in git bash terminal.

Few days back i managed it to open that in git bash, see this image
如何在Git Bash终端中打开WSL目录

But now I am unable to do so, don't know how I managed to do so earlier

答案1

得分: 3

运行这个命令:

cd //wsl.localhost/Ubuntu

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

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

  2. 您没有指示要更改当前目录,没有这个信息,Bash 会将您的命令解释为运行一个名为该名称的外部程序(解决方法:使用 cd 命令)。

英文:

Run this command:

cd //wsl.localhost/Ubuntu

The command \\wsl.localhost\Ubuntu didn't work, because

  1. Bash removes backslashes while parsing the command (solution: use forward slashes: /).

  2. You didn't indicate that you want to change the current directory, without that Bash interpreted your command as running an external program by that name (solution: use the cd command).

huangapple
  • 本文由 发表于 2023年2月6日 12:13:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357281.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定