Examples of using the find command

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.


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.


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.


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.


[Home] [Search] [Index] This site maintained by webmaster@cs.auckland.ac.nz