Next 15.G: Searching Files with egrep  Up 15: File Utilities  Prev 15.E: Piping with |  Contents

Specialized

§ 15.F: Finding Files with find


A common problem for those who use Unix extensively is the difficulty of finding files. As your directory trees become more complex, you may loose track of where you put those important notes, or you may know of a little used system utility that you want to use, but not know what path it is located in. If you know the name of the file you can find it easily with the find command and the -name parameter. To use this command type find followed by the pathname you want Unix to start searching in, followed by -name and the filename you are searching for, followed by the parameter -print which tells Unix to type the command to the screen. For instance, if you have forgotten where in your directory structure you put area.f you would use:
> find ~ -name area.f -print

Unix will remind you that area.f is in:

yourhomedirectory/development/prog/area.f

The find command has an enormous number of options. If you want to find files by some characteristic, check the man pages, there is a good chance you can find parameter that will work.


Next 15.G: Searching Files with egrep  Up 15: File Utilities  Prev 15.E: Piping with |  Contents

Comments and questions to Dr. Elias N. Houstis at enh@cs.purdue.edu.