Use locate to quickly find files on Linux
locate is a great way to quickly find files on your system. It searches using an index created using the updatedb utility so it can find files much more quickly than find can.
The downside is that it won’t look for files that have changed since the last time you’ve run updatedb. On most systems this runs every day, but you can run it manually if you need to find a recently made file.
Below is a forced example, pitting find at it’s worse searching through everything:
# time find / -name "firefox"
# time locate firefox
In this case, locate is much faster. It also spits out a good deal more results than find does, so piping it into less or grep can be rather handy.
When you know what you’re looking for or need up to date information on what files are where, find will typically be much faster:
# time find /usr/bin/ -name "firefox"