我不想在“/etc”目录下找到“passwd”,但我想找到“passwd”的其余部分,我正在尝试以下操作,
sudo find / -name '/etc' -prune -o -name 'passwd' -print
这是我得到的结果,
/home/previous_cache/1_0_59/httpd-2.4.7/srclib/apr/passwd
/home/1_0_59/httpd-2.4.7/srclib/apr/passwd
/etc/pam.d/passwd
/etc/passwd
/etc/cron.daily/passwd
/usr/share/bash-completion/completions/passwd
/usr/share/lintian/overrides/passwd
/usr/share/doc/passwd
/usr/bin/passwd
这是我期望的结果,
/home/previous_cache/1_0_59/httpd-2.4.7/srclib/apr/passwd
/home/1_0_59/httpd-2.4.7/srclib/apr/passwd
/usr/share/bash-completion/completions/passwd
/usr/share/lintian/overrides/passwd
/usr/share/doc/passwd
/usr/bin/passwd
I referred this, good info about prune, but could not solve my problem
最佳答案
试试这个:
find / -path '/etc' -prune -o -name 'passwd' -print
关于linux - 无法在查找命令中使用“-prune”选项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26424527/