How to refresh ‘locate’ database

From time to time you want to use ‘locate’ command on linux or unix system, but you can’t find what you’re looking for.
It is time to update your database. Below I posted how to do it for linux and unix operating systems.

FreeBSD OS

$ sudo /usr/libexec/locate.updatedb

Linux OS

$ sudo /usr/bin/updatedb

or you can just try

$ sudo updatedb