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:
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: