Linux 上奇怪的“隐形”目录

La-*_*eja 5 linux command-line directory-structure

我在一台 Linux 机器上,正在处理一个名为“stealth”的目录,因为它可以运行和隐藏!看看这个行为:

bash-3.2$ ls /net
bash-3.2$ ls -la /net
total 4
drwxr-xr-x  2 root root    0 Jun 19 16:10 .
drwxr-xr-x 29 root root 4096 Jun 15 09:51 ..
bash-3.2$ ls /net/stealth
dir1  dir2  SERVER_LINK
bash-3.2$ ls /net
stealth
bash-3.2$ ls -la /net
total 4
drwxr-xr-x  3 root root    0 Jun 19 16:59 .
drwxr-xr-x 29 root root 4096 Jun 15 09:51 ..
dr-xr-xr-x  6 root root    0 Jun 19 16:59 stealth
bash-3.2$ uname -a
Linux cfnyps1u 2.6.18-348.18.1.el5 #1 SMP Fri Sep 6 12:37:18 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

(注意ls /net的输出在隐藏目录的内容列出前后的区别)

这种类型的目录的名称是什么,为什么它会“隐藏”直到“找到”?我最终弄明白了发生了什么,但我以前从未见过这种行为,这肯定会使使用标准方法更难找到目录的内容。

War*_*ick 10

您正在看到 autofs 行为。/net 往往包含自动挂载的目录。自动挂载的目录在您专门使用它们之前不会挂载。它们将在设定的时间内保持安装状态,然后如果在该时间段内未使用,它们将自动卸载。

尝试跑步

人 autofs

查看有关此的文档。