Reputation: 214
I don't want to find "passwd" under "/etc" directory, but I do want to find rest of the "passwd", I am trying following,
sudo find / -name '/etc' -prune -o -name 'passwd' -print
this is the output I get,
/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
this is the output I expect,
/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
Upvotes: 1
Views: 116
Reputation: 37023
try -path instead of -name
sudo find / -path /etc -prune -o -name 'passwd' -print
Upvotes: 0