Unix Commands  «Prev  Next»
Lesson 2 The find command
Objective Use find to identify files from within a script.

Unix find Command

The find command locates files based on characteristics such as the file name or type of file. You can use find when you cannot remember where you stored a file. The following displays the find command.

find / -name petchip -print


The –type and –user options

To locate a file by owner or file type, use the following command:
find /tmp -type f –user jane –print

Starting in the /tmp directory, this command searches for files that are type f (regular files as opposed to directory files) and owned by the user called jane. When the files are found they are printed onto the computer screen.
Here is a review of some common file types.
The next lesson shows how to use the wc command to count the words, lines, and characters in a file.