locate command doesn’t find all files

When using the locate command in linux you may notice that it doesn’t always find the files that you would expect. Such as files there were recently added to the system. This is because the locate command searches an index database of all the files on the filesystem. New files may have not been added to the database yet. To rebuild the database you can use the following command:

updatedb

This will take a while since it will re-index all the files, including any new ones i finds. After the process completes you can use the locate command

locate new_file

Where the new file is the file you wish to find.

Be the first to comment

Leave a Reply