find
The find command locates the files which match specified expression. It begins finding for files in the provided directory and continues its search by all subdirectories. It also gives a mechanism for performing actions on the files which meet the find criteria.
Syntax
find path expression
IN the given syntax path is the list of directories to be fined. The names are separated through space or tab. The dot (.) notation can be used to find the current directory.
Here expression can be:
-name <file> denotes the names of files to be found in the specified directory. For instance: find /usr/ajay -name *.c will find all files along with extension .c in the /usr/ajay directory.
-print Causes the current path name to be printed.
-type c denotes the type of the file is c, where c is d, l, b, c, p, or f for block special file, character special file, directory, symbolic link, fifo (named pipe), or plain file, correspondingly.
-size n[c] Search the files containing n blocks. If n is followed through c, then n is counted in characters alter of blocks.
-exec cmd Executes the command cmd. A pair of braces {} can be set to signify the presence of present pathname. The cmd have to be end with an escaped semicolon (\;).
The expressions can also be used in combination.
-ok command such as -exec, except in which the produced command line is printed with a (?) question mark first and is executed only if the user responds through typing y.
The following instance searches all the files under the current directory and prints them
# pwd
/usr/sunil
# find .
.
./salary
./file1
./file2
./file3