I need to search for files that has no user OR no group.
find / -nouser -o -nogroup
I think this is OK. But, I don't want to search NFS shares. How can I exclude the NFS shares in the find command?
findnfs
I need to search for files that has no user OR no group.
find / -nouser -o -nogroup
I think this is OK. But, I don't want to search NFS shares. How can I exclude the NFS shares in the find command?
Best Answer
With GNU find, you can use the
-fstype
predicate:Having said that, hymie's approach probably makes more sense: white-list what FS you want to search rather than black-listing those that you don't want to search.
If you want to only include
jfs2
file systems (assuming/
is onjfs2
), then, you need to write it:Don't write it:
As while that would stop
find
from printing files in non-jfs2 filesystem, that would not stop it from crawling those non-jfs2 filesystems (which you need-prune
for).Note that
-a
(AND which is implicit if omitted) has precedence over-o
(OR), so you need to watch whether parenthesis are needed or not.The above correct command is short for: