plocate
Quickly locate files by name
TLDR
Look for patterns in the database (recomputed periodically)
Look for a file by its exact filename (a pattern containing no globbing characters is interpreted as *pattern*)
SYNOPSIS
plocate [OPTION]... PATTERN...
PARAMETERS
-b, --basename
Search only the base name of files, ignoring the directory path.
-c, --count
Instead of printing filenames, print only the total number of matches found.
-d DATABASE, --database=DATABASE
Specify a custom database file to search instead of the default system-wide database.
-i, --ignore-case
Perform a case-insensitive search, matching both uppercase and lowercase characters.
-l LIMIT, --limit=LIMIT
Limit the number of results to display to the specified numeric limit.
-r, --regex
Interpret the provided PATTERN as a regular expression for more flexible matching.
-w, --wholename
Match the entire path (this is the default behavior), not just the basename.
-0, --null
Print entries separated by a NUL character instead of a newline, useful for scripting.
-q, --quiet
Do not report errors about database problems or other minor issues.
-V, --version
Display version information about plocate and exit.
-h, --help
Display a help message summarizing command usage and options, then exit.
DESCRIPTION
plocate is a significantly faster alternative to the traditional locate command, designed for quickly finding files by name on a Linux system. It achieves its speed by querying a pre-built database of filenames, typically generated by the updatedb command. Unlike find, which scans the filesystem in real-time, plocate's lookup is almost instantaneous because it simply reads from an indexed file.
This makes it ideal for systems with vast numbers of files where real-time searches would be prohibitively slow. It's often used as a drop-in replacement for mlocate, offering superior performance, especially with very large databases, due to its efficient database handling and parallel processing capabilities.
CAVEATS
The primary limitation of plocate, like other locate implementations, is that its database is not updated in real-time. Files created, deleted, or renamed since the last updatedb run will not be accurately reflected in search results.
The accuracy of results depends entirely on the frequency of database updates. If updatedb is not run regularly, search results can become stale.
plocate respects filesystem permissions recorded in the database; it will only show files that the user running plocate would ordinarily have access to view, based on the permissions at the time the database was built.
DATABASE UPDATES
plocate relies on a database generated by the updatedb command, which is typically run daily via a cron job. To ensure the most up-to-date results, ensure your system is configured to run updatedb regularly.
Example: sudo updatedb
PERFORMANCE ADVANTAGE
plocate achieves its superior speed by memory-mapping the database file, allowing for very fast disk I/O. It also employs highly optimized search algorithms and can utilize multiple CPU cores for parallel processing, making it exceptionally efficient for searching through millions of filenames.
HISTORY
plocate was developed as a modern, high-performance alternative to existing locate implementations, notably mlocate. Written in Rust, it leverages memory-mapping and highly optimized search algorithms to deliver significantly faster results, especially on systems with very large locate databases.
Its development aimed to provide a drop-in replacement that could handle gigabyte-sized databases with near-instantaneous query times, addressing the performance bottlenecks of older tools.