Skip network filesystems when searching with find

by
on
January 19, 2009

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:

$ find / -xdev -name myfile.txt

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

1 Comment
system administration
, , , , , , ,

Related posts:

  1. Search for files with the find command
  2. Disable ext3 boot-time check with tune2fs
  3. Share a remote filesystem over SSH
  4. Mount a VirtualBox shared folder inside a guest VM
  5. Google Chrome Text Highlight Searching and Navigation

Comments (1)

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.

Trackbacks (0)

No trackbacks yet

Leave a Comment

(displayed with your post)
(will not be published)
(optional)

Copyright 2008-2010 WiredRevolution.com. All rights reserved.