where is the updatedb database located?

Solution 1:

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.

Solution 2:

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)

Solution 3:

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?


Solution 4:

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

Tags:

Linux