I'd like to use mlocate on my Ubuntu server, but only to index certain directories (e.g. /home
and /data
, but not everything under /
). However, mlocate's standard configuration works the opposite way; you specify the paths you want to remove (with PRUNE_PATHS
).
Is there any easy way to achieve this, or any similar utility that will do what I want? (note: it should maintain an index like mlocate
, so find
is not acceptable, for example) Thanks.
Edit the file
/etc/updatedb.conf
Set up
PRUNEPATHS
with the directories you DO NOT want to searchPRUNEPATHS
: A whitespace-separated list of path names of directories which should not be scanned by updatedb. Each path name must be exactly in the form in which the directory would be reported by locate. By default, no paths are skipped.Note that all of the above configuration information can also be changed or updated through the command line options to the utility
updatedb
.You can use the -U option (--database-root PATH)
-o writes to the output file
-l 0 makes that you can read it, otherwise it is only accessible for locate
Then you can then use it like:
-d sets the databasepath
To use mlocate with more than one root directory, simply create two databasefiles, and use locate with two databasepath's options like this:
To sum it up and answer the question more specific:
I found something else you could try:
Not very sure about indexing.