Linux 下 "cd ⼀" 和 "cd ⼀⼀" 区别?

2025-03-12 17:54:09
推荐回答(4个)
回答1:

没什么区别,历史遗留问题
E10) Why does `cd //' leave $PWD as `//'?

POSIX.2, in its description of `cd', says that *three* or more leading
slashes may be replaced with a single slash when canonicalizing the
current working directory.

This is, I presume, for historical compatibility. Certain versions of
Unix, and early network file systems, used paths of the form
//hostname/path to access `path' on server `hostname'.

回答2:

cd - 回到之前所在的目录
eg:
#cd /home
#cd /opt
# cd - (回到/home目录)
cd ~ 进入当前用户的家目录
eg:
#cd ~ (进入 /root 目录)
请采纳答案,支持我一下。

回答3:

/在linux下面是根的意思
cd / 代表进入根目录
cd //代表进入根目录下的根目录

回答4:

楼主好
pwd显示2个根,也让我费解,哪位可以讲讲吗?