How do I find a file?
Author: Deron Eriksson
Description: This Linux tutorial demonstrates how to find files using the find command.
Tutorial created using: CentOS release 4.6
The "find" command can be used to find a file or files in UNIX. If you don't specify a directory to search, the find command will start the search in the current directory. The directory to search can be specified right after the find command. The find command has many options, but probably the most common option is to use the "-name" switch followed by the file name criteria that you'd like to search for.
In this example, we search the commons-lang directory for all files ending in ".pom". Notice the use of the * wildcard.
find /home/jarvana/www/maven2/commons-lang -name *.pom
If we change to the commons-lang directory, we could perform the same search without the path to commons-lang.
find -name *.pom
We can see these find commands executed below.