Linux find/search root partition ONLY?
Use the -xdev
argument to find
-xdev Don’t descend directories on other filesystems.
The POSIX standard defines the -xdev
”primary“:
it shall cause find not to continue descending past directories that have a different device ID
This is implemented in GNU's find
(i.e. the findutils; docs).
GNU find
also allows you to use -mount
as ”an alternate name for -xdev
, for compatibility with some other versions of find.“
On BSD systems and macOS the option is -x
instead. They (imho confusingly) call -xdev
to be ”deprecated“. You can, however, use -mount
instead. [manpages of FreeBSD and macOS]
other tools, just FYI
If you're using ripgrep (rg
) like rg --files
, you can use the --one-file-system
option, which does the same like find's -xdev
option.