“Find” command:
This will allow you to find the files/folders within a directory or recursively, that match the searching pattern whichever you are given to search.
#find .
Above command will indicate search in the current directory.
-name: This option will help you to find a file that matches the specific pattern.
And we can use metacharacters like “*”,” ” with enclosure of double quotes “”
Example:
[root@linux etc]# find . -name mtab./mtab
[root@linux /]# find /etc -name passwd/etc/passwd/etc/pam.d/passwd -> this command will find files for starting like passwd under the /etc directory.
Using the “Locate” command:
Locate command is faster than find command. Because it’s using a database which is previously built the database for search. Locate command will list all the path names which containing your search pattern.
The database is updated using corn or we can also manually update the database using below command.
#sudo updatedb
Example:
#locate mydata