A modern search tool
Command Line – plocate

© Lead Image © Author, 123RF.com
As the latest successor to locate, plocate produces some of the quickest search results possible on any system.
Real estate agents sometimes say that the key to success is location, location, location. This saying might almost summarize the history of the locate
command [1] and its various successors, particularly mlocate
[2] and plocate
[3]. As a replacement for find
, all three commands use a database solution to reduce search time. While all three share many of the same options, plocate
is widely considered the most efficient choice.
Slightly different versions of locate
are available in the BSD and GNU findutils, but you can also find locate
, mlocate
, and plocate
as separate commands. Because the number of choices can be confusing, a history seems in order. First released in 1982, locate
uses a database that can be read by any user. If regular expressions are not used, it displays every instance of the string entered on the system, which is inconvenient if the string is common. However, locate
's most serious limitation is that the database has to be updated manually. Largely because of these problems – especially the need for manual updates – locate
was succeeded briefly by slocate
(secure locate) [4] until replaced in 2006 by mlocate
(merging locate). Both slocate
and mlocate
are an improvement over locate
in that they contain the utility updatedb
[5] to update databases, speeding up the process by only searching for files and directories where the ctime
has changed. Also, both slocate
and mlocate
show only the files that the current user has access to, thereby improving security, and they allow regular expressions to be used without a specific option. Written by Miloslav Trmac while he participated in the Google Summer of Code, mlocate
became the preferred version until 2020, although it seems to have gone through periods of being unmaintained.
Named for the posting lists that inspired it, plocate
was written to be a drop-in replacement for mlocate
. While it can still use updatedb
to create its database, plocate
can also use the plocate-build
utility [6] to create an index when a root user is logged in. Unlike mlocate
, when multiple strings are searched, plocate
returns only the files that match all the search strings, rather than any file that matches even one string. Another difference from mlocate
: plocate
is compatible with systemd and SELinux. Instead of scanning every entry one at a time, plocate
scans trigrams (i.e., combinations of three bytes at a time) to increase search speeds. Although specifically designed for solid state drives (SSDs), on older hard drives, plocate
can gain further speed by using the io_uring
Asynchronous I/O (AIO) framework introduced in the Linux 5.1 kernel in March 2019 [7]. As its main limitation, plocate
's benefits may be lost when searching for strings shorter than three bytes, for non-UTF-8 file names, or for regular expressions with numerous hits. Usually, its enhancements mean that plocate
can find two files out of 27 million in .008 milliseconds, while mlocate
takes 20.118 milliseconds for the same operation [8]. Even though locate
and mlocate
are still available, in most circumstances, plocate
should be the preferred variant.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

News
-
Blender App Makes it to the Big Screen
The animated film "Flow" won the Oscar for Best Animated Feature at the 97th Academy Awards held on March 2, 2025 and Blender was a part of it.
-
Linux Mint Retools the Cinnamon App Launcher
The developers of Linux Mint are working on an improved Cinnamon App Launcher with a better, more accessible UI.
-
New Linux Tool for Security Issues
Seal Security is launching a new solution to automate fixing Linux vulnerabilities.
-
Ubuntu 25.04 Coming Soon
Ubuntu 25.04 (Plucky Puffin) has been given an April release date with many notable updates.
-
Gnome Developers Consider Dropping RPM Support
In a move that might shock a lot of users, the Gnome development team has proposed the idea of going straight up Flatpak.
-
openSUSE Tumbleweed Ditches AppArmor for SELinux
If you're an openSUSE Tumbleweed user, you can expect a major change to the distribution.
-
Plasma 6.3 Now Available
Plasma desktop v6.3 has a couple of pretty nifty tricks up its sleeve.
-
LibreOffice 25.2 Has Arrived
If you've been hoping for a release that offers more UI customizations, you're in for a treat.
-
TuxCare Has a Big AlmaLinux 9 Announcement in Store
TuxCare announced it has successfully completed a Security Technical Implementation Guide for AlmaLinux OS 9.
-
First Release Candidate for Linux Kernel 6.14 Now Available
Linus Torvalds has officially released the first release candidate for kernel 6.14 and it includes over 500,000 lines of modified code, making for a small release.