locate command is one of the best tools for quickly finding files by filename. The locate command reads one or more databases prepared by updatedb and writes file names matching at least one of the patterns to standard output, one per line.Pre-Flight Check
In this guide, we will show you how to install mlocate on CentOS 8
First, we will illustrate the difference between locate and mlocate
Difference between locate & mlocate
The locate package is the implementation of locate from GNU findutils. The mlocate package is another implementation of the same concept called mlocate.
They implement the same basic functionality: quick lookup of file names based on an index that’s (typically) rebuilt every night. They differ in some of their functionality beyond basic usage.
mlocate is a merging locate and database package. “Merging” means updatedb reuses the existing database to avoid re-reading most of the file system. This makes the database update faster and does not tax the system caches.
mlocate can index several file systems including network file systems for network shares. This package is essential when attempting to quickly find documents in a terminal.
Under Debian and derivatives, if you install both, locate will run the mlocate implementation, and you need to run locate.findutils to run the GNU implementation. This is managed through alternatives.
If you have both installed, they’ll both spend time rebuilding their respective index, but other than that they won’t conflict with each other.
- Update the system packages
dnf -y update
Install mlocate .
dnf -y install mlocate
- update mlocate
The above command will update the search databases
NOTE: mlocate installs a cron job that will run daily to update search databases at:
- Check the mlocate version
- Check the man page for locate
In this article, we showed you how to install mlocate on CentOS 8 in addition to, the difference between locate and mlocate.