17

I would like to remove with purge all entries of locate and its database.

I tried

apt-get purge locate

and

rm /etc/updatedb*

But is the database gone also?
Where is the updatedb database located on debian squeeze?

I would like to delete it manually too, so I can cleanly reinstall it

6 Answers 6

15

man updatedb

search for 'FILES'

mine says:

FILES
       /etc/updatedb.conf
              A configuration file.  See updatedb.conf(5).

       /var/lib/mlocate/mlocate.db
              The database updated by default.
4
  • 1
    That's mlocate, not locate. Though /var/lib/locate is not a bad guess for locate. Dec 1, 2012 at 11:36
  • 1
    I'm trying to give both general advice and the results of following said advice on my system.
    – ptman
    Dec 1, 2012 at 11:39
  • 2
    Oh, and it seems like mlocate is the standard locate on Debian.
    – ptman
    Dec 1, 2012 at 11:43
  • mlocate is not installed, neither slocate
    – rubo77
    Dec 2, 2012 at 8:09
15

No need to decompile the executable! Just kindly ask 'locate' :-)

For updatedb/locate (GNU findutils) version 4.6.0 try calling

locate --statistics

For me (on cygwin) this yields someting like

Database /var/locatedb is in the GNU LOCATE02 format.
Database was last modified at 2017:03:13 22:44:31.849172100 +0100
Locate database size: 6101081 bytes
All Filenames: 202075
File names have a cumulative length of 22094021 bytes.
Of those file names,

    2591 contain whitespace,
    0 contain newline characters,
    and 20 contain characters with the high bit set.
Compression ratio 72.39% (higher is better)
11

On debian, the locate database is stored by default in

/var/cache/locate/locatedb

If you use mlocate as search indexer:

The mlocate database is stored at

/var/lib/mlocate/mlocate.db

see: How can I view updatedb database content, and then exclude certain files/paths?

1
  • locate --statistics is the cmd line to tell where for any system
    – MikeRoger
    Aug 21, 2019 at 10:01
7

I prefer to just strace the process, as it's going to lead you right there. This will be distribution agnostic and works if you don't have the man pages.

# strace updatedb 2>&1 |grep ^open|grep db

open("/etc/updatedb.conf", O_RDONLY)    = 3
open("/var/lib/mlocate/mlocate.db", O_RDWR) = 3
open("/var/lib/mlocate/mlocate.db.bUUaw4", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
2

[REDACTED in 2017]: See above answer: locate --statistics works.

If you have an /etc/updatedb.conf, you can look in there. I don't. You can read the man page for locate, which says the default location is /var/cache/locate/locatedb. Mine isn't there. You can use locate itself to search for files named "updatedb" or "locatedb". I'm using Cygwin on Windows 7.

3
  • and if you search for mlocate.db?
    – rubo77
    Oct 19, 2013 at 21:06
  • 1
    @phil-goetz There's no need to decompile. You can get the exact location with a one-liner if you have strace installed: $ sudo strace updatedb 2>&1 | grep -o "^open.*O_RDWR.*"
    – Cengiz Can
    Sep 4, 2014 at 7:23
  • @Cengiz: Clever! My update db is simply /var/locatedb .
    – Phil Goetz
    Nov 14, 2017 at 19:57
0

on mac --statistics is invalid

man locate

FILES /var/db/locate.database locate database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.