You won’t typically find updatedb explicitly listed in user crontabs like /etc/crontab or under crontab -e. Instead, the updatedb command is generally managed through systemd timers or system-wide cron jobs specific to certain package-managed cron directories.
Here’s where it might be scheduled:
- Systemd Timer:
- In many modern Linux distributions (such as Fedora, Ubuntu, and Arch),
updatedbis run by asystemdtimer. You can check if this is active with:systemctl list-timers | grep mlocate - For
mlocate, it often uses a timer calledmlocate-updatedb.timer, which is configured to run at intervals defined by the distribution. If present, it can be found in/usr/lib/systemd/system/or/etc/systemd/system/.
- In many modern Linux distributions (such as Fedora, Ubuntu, and Arch),
- Cron Directory:
- In distributions where
systemdis not used,updatedbmight be scheduled in a cron directory, commonly found in/etc/cron.daily/or/etc/cron.weekly/. These scripts are run automatically at specific intervals by thecronservice. - Look for an
mlocateorupdatedbscript within these directories. For example:ls /etc/cron.daily | grep mlocate
- In distributions where
- Legacy Location (
/etc/crontab):- In some older setups,
updatedbis directly scheduled in/etc/crontab. However, this is less common now due to the adoption of systemd timers and separate cron directories.
- In some older setups,
You can also manually trigger an updatedb run if needed by simply executing:
sudo updatedb
This variety in scheduling method can depend on the distribution and the version of the mlocate or slocate package installed.