The locate Command is an Incredibly Useful Utility to Find Files and Directories on Linux, Unix and Mac.
The Locate Command Consult a Pre-compiled Index of the Filesystem that Match a Particular Pattern.
For Example to Find All Files and Directories Containing the Keyword pattern:
locate pattern
.
It is Included by Default on most Linux Systems and on Mac but must be Installed by hand on Unix.
The locate‘s Database is Updated periodically by the updatedb Command, which Can be Scheduled to Run by cron.
The Index is Perfectly Up-to-Date Only After the updatedb has been Executed.
So Generally to Update the Index if updatedb is on System Path:
updatedb
.
To Get Extra Insight on Locate Command Look this other Guide:
Advanced locate Tutorial to Refine Searching
.