我使用'find'命令查找文件并遇到一个奇怪的问题:
文件存在,但“find”找不到
我在/run 中找到了两个 .sock 和 'sudo find/run -name docker.sock'
$sudo find /run -name docker.sock
/run/march/docker.sock
/run/docker.sock
运行时我什么都没得到 'sudo find/var -name docker.sock' 和 'sudo find/var/run -name docker.sock' $sudo find /var -name docker.sock
$sudo find /var/run -name docker.sock
$
但实际上/var/run/ 中有两个 .sock , 任何意见?$ls -al /var/run/docker.sock
srwxrwxrwx+ 1 root docker 0 Oct 18 20:45 /var/run/docker.sock
$ls -al /var/run/march/docker.sock/
total 0
drwxr-xr-x 2 root root 40 Oct 31 20:35 .
drwxr-xr-x 5 root root 100 Oct 31 20:35 ..
$ls -al /var/run/march/
total 0
drwxr-xr-x 5 root root 100 Oct 31 20:35 .
drwxr-xr-x 34 root root 1120 Oct 31 23:45 ..
drwxr-xr-x 2 root root 40 Oct 31 20:35 docker
drwxr-xr-x 2 root root 40 Oct 31 20:35 docker.pid
drwxr-xr-x 2 root root 40 Oct 31 20:35 docker.sock
$
$
顺便说一句,它在 Ubuntu 20.04.2 LTS 上提前致谢
最佳答案
由于/var/run 是/run 的符号链接(symbolic link),你必须告诉 find
跟随链接:
sudo find -L /var/run -name docker.sock
关于linux - ubuntu上find命令的奇怪问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69793870/