mlocate is a new locate implementation. The ‘m’ stands for “merging”: updatedb reuses the existing database to avoid rereading most of the file system, which makes updatedb faster and does not trash the system caches as much.

The locate(1) utility is intended to be completely compatible to slocate. It also attempts to be compatible to GNU locate, when it does not conflict with slocate compatibility.


mlocate tarballs are available at

Current version: 0.26

mlocate is also included in Fedora Core 6 and later.


Please consider reporting the bug to your distribution’s bug tracking system.

Otherwise, report bugs at Bug reports with patches are especially welcome.


These measurements were obtained with mlocate-0.12 and slocate-2.7. Each time, a computer was booted into single-user mode and after one updatedb run data was collected using slabtop and free. The measurement method is admittedly crude, but I think the numbers represent reality quite well.

Run: real user system dentry inode buffers cached
slocate 1m32.84 0.704 2.045 134337 170778 85972 8268
mlocate, 1st 1m11.65 0.214 0.908 17766 15642 78452 21340
mlocate, 2nd 37.64 0.105 0.289 17776 15639 33996 21336
real, user, system
as reported by time
dentry, inode
number of active objects in dentrycache and ext3inode_cache, as reported by slabtop
buffers, cached
size of disk buffers and page cache, as reported by free

mlocate has two rows because the first run needs to scan the whole file system, while the subsequent runs can reuse most of the original database.

19 Responses to mlocate

  1. Pingback: 狗爺語錄 » Blog Archive » 原來 ubuntu server 是這麼一回事

  2. Pingback: newslife site » linux user podcast 99

  3. Pingback: » Running mlocate on Mac OS X » Blog Archive » international geographic

  4. Pingback: Finding Files with locate | Yet Another Linux Blog

  5. Pingback: Finding Files with locate | Boomeroo Web Resources

  6. Pingback: mlocate: una nueva implementación de locate « Debianeando

  7. Pingback: Ubuntu server cron jobs « nelsonslog

  8. Hi Miloslav,

    Would it be reasonably feasible to add file date and size in the locate database?



  9. mitr says:

    I’m afraid geting file data and size would require a stat() system call for each file, and it would be impossible to merge data from the previous database; the overall performance impact would be too high.

  10. krogon says:

    mlocate should include this fs in PRUNEFS: s3fs and fuse.s3fs

  11. mitr says:

    mlocate itself does not ship a configuration file, please report this in the bug tracker of your distribution.

  12. Brennan S says:

    Quick question about updatedb’s very deep hiearchy test. The path generated goes way past PATH_MAX, which causes problems with gentoo’s sandbox. To work around this I shortened the names of the directories generated to just a number, which allows the same number of directories but all with shorter names. Is this an acceptable solution, or does it defeat the purpose of the test? Thanks, Brennan

  13. mitr says:

    Well, it does defeat the purpose of the test, but building a secure user-space sandbox that doesn’t limit path length to PATH_MAX may be really difficult.

    Considering that the “real” version of the test must have succeeded before building a release tarball, limiting the test in a sandbox is a fairly reasonable approach in this case.

  14. Pingback: Wheezy, GNOME 3.4, search for files from GNOME-shell w/ indexing

  15. Pingback: mlocate: una nueva implementación de locate

  16. Hi Miloslav, Would it be reasonable to add option for colors in output (like –color in grep)? Best regards. Salvatore Picerno

  17. mitr says:

    –color would make sense; I’m afraid I don’t have time to work on it currently, filed as so it isn’t forgotten.

  18. Richard Lemieux says:

    Hi Miloslav, Is there a way to tell ‘locate’ to return all the entries in the database whether disks are currently mounted or not?

    I have six disks of which I leave four unmounted and spun down most of the time; I just mount them when I need them; they are older disks I use as backup. I run ‘update’ when all disks are mounted and I would like ‘locate’ to return entries for all disks it was run on even when those disks are unmounted. Currently ‘locate’ just searches the currently mounted disks.

  19. mitr says:

    Richard, you’ll need to pass --require-visibility no to (updatedb) (and not use -e with (locate)); the visibility checking is what prevents reporting files in non-existent directories by default.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>