Examples of using the find command

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 unixhelp@math.rutgers.edu
This page was last updated on September 05, 2006 at 10:29 am and is maintained by webmaster@math.rutgers.edu.
For questions regarding courses and/or special permission, please contact mclausen@math.rutgers.edu.
For questions or comments about this site, please contact help@math.rutgers.edu.
© 2012 Rutgers, The State University of New Jersey. All rights reserved.