find 缺少结果——这怎么可能?

find 缺少结果——这怎么可能?

什么条件可以解释此输出:

root@ip:/# find / -name "server.xml" -print
/etc/tomcat7/server.xml
root@ip:/# ls /var/lib/tomcat7/conf/server.xml 
/var/lib/tomcat7/conf/server.xml

我以 root 身份运行它,并从根目录开始查找。我不明白为什么我用“ls”命令显示的文件没有出现在结果中。

编辑

输出mount

/dev/xvda1 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)

和:

root@ip:/# ls -la /var/lib/tomcat7/conf/
total 196
drwxr-xr-x  4 root root      4096 Apr 29 03:22 .
drwxr-xr-x 95 root root      4096 Apr 29 04:23 ..
drwxrwxr-x  3 root tomcat7   4096 Apr 29 03:22 Catalina
-rw-r--r--  1 root tomcat7   5586 Apr  1 20:32 catalina.properties
-rw-r--r--  1 root tomcat7   1394 Feb 25  2012 context.xml
-rw-r--r--  1 root tomcat7   2370 Jul 12  2012 logging.properties
drwxr-xr-x  2 root tomcat7   4096 Apr 29 03:22 policy.d
-rw-r--r--  1 root tomcat7   6500 Apr  1 20:32 server.xml
-rw-r-----  1 root tomcat7   1530 Feb 25  2012 tomcat-users.xml
-rw-r--r--  1 root tomcat7 152716 Feb 25  2012 web.xml

和:

root@ip-:/# ls -la /var/lib/tomcat7
total 24
drwxr-xr-x  6 root    root    4096 Apr 29 03:22 .
drwxr-xr-x 40 root    root    4096 Apr 29 01:26 ..
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 common
lrwxrwxrwx  1 root    root      12 Apr  1 20:32 conf -> /etc/tomcat7
lrwxrwxrwx  1 root    root      17 Apr  1 20:32 logs -> ../../log/tomcat7
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 server
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 shared
drwxrwxr-x  4 tomcat7 tomcat7 4096 Apr 29 04:20 webapps
lrwxrwxrwx  1 root    root      19 Apr  1 20:32 work -> ../../cache/tomcat7

答案1

/var/lib/tomcat7/conf如果是到 的符号链接,就会发生这种情况/etc/tomcat7

默认情况下,find(无论如何 coreutils 版本)不会遵循符号链接。尝试使用-L标志:

find -L / -name "server.xml" -print 

相关内容