To locate a file in the file system, use the find command.
find pathname -name filename -print
The pathname defines the directory to start from. Each subdirectory of this directory will be searched.
The -print option must be used to display results.
You can define the filename using wildcards. If these
are used, the filename must be placed in 'quotes'.
Examples of using the find command
1. To find a single file below the current directory:
find . -name mtg_jan92 -print
This displays the pathname to the file mtg_jan92 starting from the current directory. If the file is not found nothing is displayed.
2. To find a file below your home directory:
find ~/ -name README -print
This displays the pathname to every file with the name README in your home directory or its subdirectories.
3. To find several files below the current directory:
find . -name '*.fm' -print
This displays the pathname to any file with the extension .fm which exists below the current directory.
4. To find a directory:
find /usr/local -name gnu -type d -print
This searches to see if there is a subdirectory gnu in the directory /usr/local.