find - Search For Files In A Directory Hierarchy
The find command has an incredibly wide range of options that allow one to search through the file system for files with many search options. For example, one could look for a file that started with the characters stran, was modified two days ago, is 1000 bytes long, and owned by the user, newuser. Only a few options will be covered here, the man pages and info pages give much more detail about this powerful command. Table 7 shows a short list of some of the possible options that can be used with this command.
First lets look at the general form and common options (shown in Table 14).
find [path ] [expression ...]
An example or two will help:
find . -name hat*
This will search in the current directory (remember . refers to the current directory) and in sub directories for any files that start with the characters, hat, followed by the number 2 or 3 and having zero or more additional characters.
find / -user new_user
This will start a search at the root directory and search through all of the systems directories and sub directories for any file owned by the user new_user and list all those files.
find /var -mtime -1
This will search in the directory /var looking for files that were modified within the last 24 hours.
Note: searching in directories for which one does not have permission to read will report an error appear for those directories stating that there were insufficient permissions to search that directory.
Find will keep executing, looking through every directory within the path given.
If find is given, a search list of a large number of directories or files it can take a long time to execute, as in the second example, starting at the root directory, can take several seconds. Be patient.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.