我不想找到" passwd"在" / etc"目录,但我确实希望找到" 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
答案 0 :(得分:2)
试试这个:
find / -path '/etc' -prune -o -name 'passwd' -print
答案 1 :(得分:0)
尝试-path而不是-name
sudo find / -path /etc -prune -o -name 'passwd' -print