Upadate DataBase for locate Command using updatedb Command


Update database for locate command with updatedb command


   The updatedb command is use to update the database entry that use by locate command to search faster for files or folder in Linux system.  The database usually automatically updated daily by cron.  The example below show the use of updatedb command manually.



Type in the updatedb command on the terminal and then hit the Enter key.. wait for few second..

update the locate database with updatedb command

[root@fedora ~]# updatedb

[root@fedora ~]#


Default updatedb configuration file locate under:


[root@fedora ~]# cat /etc/updatedb.conf


PRUNEFS = "auto afs gfs gfs2 iso9660 sfs udf"  

PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/spool/cups /var/spool/squid /var/tmp" 

[root@fedora ~]# 


The default locate database update by updatedb command:



The setting for updatedb command on crond to update the locate database daily:

[root@fedora ~]# cat /etc/cron.daily/mlocate.cron


nodevs=$(< /proc/filesystems awk '$1 == "nodev" { print $2 }')

renice +19 -p $$ >/dev/null 2>&1

ionice -c2 -n7 -p $$ >/dev/null 2>&1

/usr/bin/updatedb -f "$nodevs"

[root@fedora ~]#


Note:  The command above tested on Fedora 9.


Keywords: update locate database, updatedb command, update database command, locate command database, locate database, update database locate


1 comment


basic unix commands

updating data base command