{{tag>FS}}
= Cherche rapide de fichier grâce à updatedb et locate
Voir aussi :
* plocate (a vocation de remplacer le bon vieux mlocate)
=== Exemple 1
# systemd-run -p IOWeight=10 updatedb
updatedb -l 0 -o db_file -U source_directory
locate -d db_file NOM_FICHIER
=== Exemple 2
updatedb -l 0 --prunenames ".git .bzr .hg .svn .gz" --prunepaths "${HOME}/tmp ${HOME}/mnt" -U ~ -o ~/mlocate.db
locate -d ~/mlocate.db NOM_FICHIER
locate -d ~/mlocate.db NOM_FICHIER -0 | xargs -0 ls -ld
Note : prunepaths doit contenir des chemin absolus
[[http://fr.wikipedia.org/wiki/Locate]]
[[http://www.thegeekstuff.com/2012/03/locate-command-examples/]]
Examples
To create a private mlocate database as an user other than root, run
updatedb -l 0 -o db_file -U source_directory
Source : [[http://linux.die.net/man/8/updatedb]]