Go to the next chapter.
This file documents the GNU utilities for finding files that
match certain criteria and performing various actions on them.
This is edition 1.1, for
This manual shows how to find files that meet criteria you
specify, and how to perform various actions on the files that you
find. The principal programs that you use to perform these tasks
Mail suggestions and bug reports for these programs to
For brevity, the word file in this manual means a regular file, a directory, a symbolic link, or any other kind of node that has a directory entry. A directory entry is also called a file name. A file name may contain some, all, or none of the directories in a path that leads to the file. These are all examples of what this manual calls ``file names'':
parser.c README ./budget/may-94.sc fred/.cshrc /usr/local/include/termcap.h
A directory tree is a directory and the files it contains, all of its subdirectories and the files they contain, etc. It can also be a single non-directory file.
These programs enable you to find the files in one or more directory trees that:
Once you have found the files you're looking for (or files that are potentially the ones you're looking for), you can do more to them than simply list their names. You can get any combination of the files' attributes, or process the files in many ways, either individually or in groups of various sizes. Actions that you might want to perform on the files you have found include, but are not limited to:
This manual describes how to perform each of those tasks, and more.
The principal programs used for making lists of files that
match given criteria and running commands on them are
find [file...] [expression]
Here is a typical use of
find /usr/src -name '*.c' -size +100k -print
locate [option...] pattern...
This example prints the names of all files in the default file
name database whose name ends with Makefile or makefile.
Which file names are stored in the database depends on how the
system administrator ran
xargs [option...] [command [initial-arguments]]
The following command searches the files listed in the file file-list and prints all of the lines in them that contain the word typedef.
xargs grep typedef
The expression that
You can omit the operator between two primaries; it defaults to -and. See section Combining Primaries With Operators, for ways to connect primaries into more complex expressions. If the expression contains no actions other than -prune, -print is performed on all files for which the entire expression is true (see section Print File Name).
Options take effect immediately, rather than being evaluated for each file when their place in the expression is reached. Therefore, for clarity, it is best to place them at the beginning of the expression.
Many of the primaries take arguments, which immediately follow
them in the next command line argument to
To return to the Ready-to-Run Software Super ReadyPak Table of Contents please press here.
Email addresses listed on this site may NOT be used for unsolicited commercial email.
Portions (c)Copyright, 1996-2005 by