Finding Files with find

Contents:
The find Command Is Great; The Problem Is Finding How to Use It
Delving Through a Deep Directory Tree
Don't Forget -print
Looking for Files with Particular Names
Searching for Old Files
Be an Expert on find Search Operators
The Times that find Finds
Exact File Time Comparisons
Problems with -newer
Running Commands on What You Find
Using -exec to Create Custom Tests
Finding Many Things with One Command
Searching for Files by Type
Searching for Files by Size
Searching for Files by Permission
Searching by Owner and Group
Duplicating a Directory Tree (No Pathnames with find {} Operator)
Using "Fast find"
Finding Files (Much) Faster with a find Database
grepping a Directory Tree (and a Gotcha)
lookfor: Which File Has that Word?
Finding the Links to a File
Finding Files with -prune
Skipping Some Parts of a Tree in find (A More Selective -prune)
Keeping find From Searching Networked Filesystems

The find Command Is Great; The Problem Is Finding How to Use It

find is one of UNIX's most useful and important utilities. It finds files that match a given set of parameters, ranging from the file's name to its modification date. Now, we'll be looking at many of the things it can do. As an introduction, here's a quick summary of its features and operators:

% find path operators

where path is the directory in which find will begin to search and operators (or, in more customary jargon, options) tell find which files you're interested in. The operators are:

Of course, you often want to take some action on files that match several criteria. So we need some way to combine several operators:

Another group of operators tells find what action to take when it locates a file:

A last word: find is one of the tools that vendors frequently fiddle with, adding (or deleting) a few operators that they like (or dislike). The operators listed above should be valid on virtually any system. If you check your system's manual page, you may find a few others.

- ML