In Linux, there are a variety of commands to locate files, each with its own set of advantages and disadvantages. Some are only available in certain distributions, and others are not installed by default.
Let’s start with the quickest approach to find files with locate, and then go on to find: a very powerful application that is available in virtually all Linux distributions to help users in finding files.
|Usage||locate <what you are looking for>|
|Advantages||Looks through a database, therefore, is really fast|
|Disadvantages||the database has to be updated in order to find new files|
yum install mlocate
Then update the database with the command:
sudo updatedb && locate -e bench-repo
Otherwise you will get an error: locate: can not stat () `/var/lib/mlocate/mlocate.db’: No such file or directory
|Usage||find <path> -name “<what you are looking for>”|
|Advantages||No database to use and has lots of advanced features|
|Disadvantages||Can be slow and requires more typing even for a simple search|
Search for exact matches of “whois”
find / -name "whois"
Search for files that have “whois” in their name
find / -name "*whois*"