Skip network filesystems when searching with find

1

When you run the find command on the root directory of a system you may want to exclude all network filesystems and confine your search to only your local machine. The benefits of this are obvious as it will save you a great amount of time especially if the mounted filesystem is very large.

Luckily the find command provides this ability with the ‘-xdev‘ or ‘-mount‘ options.

For example:

This command will recursively search for myfile.txt starting in your root directory and skip all externally mounted filesystems.

Share.
  • JoeMama

    Not quite. The -xdev option will skip ALL other filesystems, not just NFS. If you have multiples disks/filesystems mounted somewhere in /, you wont check them.