Unix/Linux Guru and FOSS supporter

How to run updatedb in FreeBSD

In linux update is part of package mlocate which not exit in BSD systems or maybe there is another way to use it. in this small tutorial, I will show you how to install and activate updatebd in FreeBSD. let’s see if we can find the package on the FreeBSD repositories.

root@vps-cdce6394:~ # updatedb
updatedb: Command not found.
root@vps-cdce6394:~ # pkg install mlocate 
Updating FreeBSD repository catalogue...
Fetching packagesite.txz: 100%    6 MiB   6.4MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 30172 packages processed.
All repositories are up to date.
pkg: No packages available to install matching 'mlocate' have been found in the repositories
root@vps-cdce6394:~ # 

to rebuild the database you need to run this script. this script is scheduled to run weekly. you can also move it to the daily folder if you like.

Now lets run the script in this wey

root@vps-cdce6394:~ # /etc/periodic/weekly/310.locate

Rebuilding locate database:
root@vps-cdce6394:~ # 

This script is syncing the latest updates to the local database located on /var/db/locate.database

lets See if locate command working now

root@vps-cdce6394:~ # locate httpd.conf
root@vps-cdce6394:~ # 

Its working


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook