I was recently trying to find a binary file with a certain name. I decided to use the whereis
search utility (part of the util-linux package). This managed to find the file in half the time than trying to use the comparable find
command.
I've also used the locate
command which produces results in speeds similar to whereis
.
How do these commands manage to find files so quickly in comparison to the find
command?
locate
reads from a database that is updated by a much slower, CPU-intensive search (updatedb
), typically run as a cron job... – jasonwryan Nov 16 '15 at 21:00