Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 17.24 Skipping Some Parts of a Tree in find (A More Selective -prune)Chapter 17
Finding Files with find
Next: 18. Linking, Renaming, and Copying Files
 

17.25 Keeping find From Searching Networked Filesystems

The most painful aspect of a large NFS (1.33) environment is avoiding the access of files on NFS servers that are down. find is particularly sensitive to this, because it is very easy to access dozens of machines with a single command. If find tries to explore a file server that happens to be down, it will time out. It is important to understand how to prevent find from going too far.

To do this, use -prune with -fstype or -xdev. [Unfortunately, not all finds have all of these. -JP ] fstype tests for filesystem types, and expects an argument like nfs or 4.2. The latter refers to the "fast filesystem" introduced in the 4.2 release of the Berkeley Software Distribution. To limit find to files only on a local disk or disks, use the clause -fstype 4.2 -prune or -o -fstype  nfs -prune.

To limit the search to one particular disk partition, use -xdev. For example, if you need to clear out a congested disk partition, you could look for all files greater than 40 blocks on the current disk partition with this command:

% find . -size +40 -xdev -print

- BB


Previous: 17.24 Skipping Some Parts of a Tree in find (A More Selective -prune)UNIX Power ToolsNext: 18. Linking, Renaming, and Copying Files
17.24 Skipping Some Parts of a Tree in find (A More Selective -prune)Book Index18. Linking, Renaming, and Copying Files

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System