Software⏱️ 4 min read📅 2026-06-04

How to Fix: How to update Linux "locate" cache

Update Linux locate cache to reflect new package installations.

Quick Answer: Run the command `sudo update-cache` or `sudo updatedb` to refresh the locate index.

The 'locate' cache is not being updated after installing new packages on your Debian Jessie system, causing issues with file location searches. This can be frustrating when you need to quickly find specific files but are unable to do so due to an outdated index. In this guide, we will walk you through the steps to update the 'locate' cache and resolve this issue.

Updating the 'locate' cache is a crucial step in maintaining your system's file system organization and search functionality. By following these steps, you can ensure that your 'locate' database is up-to-date and functioning correctly, allowing you to quickly find files on your system.

🛑 Root Causes of the Error

  • The primary reason for this issue is that the 'locate' cache is not being updated automatically after package installations. This is because the 'update-cache' command needs to be run manually to refresh the index. An alternative cause could be a misconfiguration of the 'locate' daemon, which might prevent it from indexing new files correctly.
  • Another possible reason for this issue could be that the 'locate' database has become corrupted or is not properly configured, leading to an incomplete or outdated index.

🔧 Proven Troubleshooting Steps

Updating the 'locate' cache using the 'update-cache' command

  1. Step 1: To update the 'locate' cache, open a terminal and run the following command: `sudo update-cache`. This will refresh the index and ensure that new files are properly indexed.
  2. Step 2: The `update-cache` command updates the 'locate' database by re-scanning the file system and recalculating the location of each file. This process can take some time, depending on the size of your file system and the number of files being indexed.
  3. Step 3: Once you have run the `update-cache` command, verify that the update was successful by checking the 'locate' database using the `sudo locate -a` command.

Updating the 'locate' cache using the 'makedb' command

  1. Step 1: Alternatively, you can use the `makedb` command to update the 'locate' cache. This command is similar to `update-cache`, but it provides more detailed information about the indexing process.
  2. Step 2: To use the `makedb` command, run the following command: `sudo makedb -r`. This will refresh the index and ensure that new files are properly indexed.
  3. Step 3: The `makedb` command also updates the 'locate' database by re-scanning the file system and recalculating the location of each file. However, it provides more detailed information about the indexing process, including any errors or warnings encountered during the update.

🎯 Final Words

Updating the 'locate' cache is a simple process that can be completed using either the `update-cache` or `makedb` command. By following these steps, you can ensure that your 'locate' database is up-to-date and functioning correctly, allowing you to quickly find files on your system.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions