I would just like point out this answer by @Gilles in Exclude paths that make find complain about permissions - Unix & Linux Stack Exchange; it basically involves a construct for find that makes it not descend unreadable directories, and in that sense, is probably also a bit faster.
This would seem to work for me:
With GNU find or any other find that supports the -readable and -executable predicates:
find / -type d ! \( -readable -executable \) -prune -o -type f -name netcdf -print
or also this:
find / -type d ! -perm -g+r,u+r,o+r -prune -o -type f -name 'netcdf' -print
For some reason, I need to add all of the g+r,u+r,o+r (shortcut for that is a+r), otherwise if one of them is left out, I may still get "Permission Denied" hits.
Here is a breakdown of how I see this (note the -a (and) operator in find is implicit between two predicates):
find / # find starting from path / -type d # match type is directory ! -perm -a+r # (and) match not permissions of `r`ead present -prune # ignore what matched above and do not descend into it -o # or (whatever didn't match above) -type f # match type is file -name 'netcdf' # (and) match name is 'netcdf' -print # print what matched above
Note that without the last -print, I get some extra items shown (that have nothing to do with -name 'netcdf'); the -print ensures that only the name matches are printed (if any).