To show how fast plocate is compared to mlocate, the plocate developer shows this benchmark on the tool's homepage in which plocate is able to find 2 files out of 27 million in just a few milliseconds:Īlso, like mlocate, plocate shows all the files matching the search query only if they are visible to the user running the command, skipping all restricted files. You might also like: How To Find Files Modified In The Last N Days Or Minutes Using find It does nearly all I/O asynchronously using io_uring if available (Linux 5.1+), which reduces the impact of seek latency on systems without SSDs. Plocate works by creating an inverted index over trigrams (combinations of three bytes) in the search strings, which allows it to rapidly narrow down the set of candidates to a very small list, instead of linearly scanning through every entry. The command-line tool is a drop-in replacement for mlocate (Merging Locate a restricted-access database, only showing filenames accessible to the user) in nearly all aspects, including reusing the mlocate database (plocate creates its own index using plocate-build which reads the database made by updatedb), and is fast on SSDs and HDDs alike. It's based on posting lists, giving much faster searches on a much smaller index. Plocate is a newer (the first stable release was less than a year ago), much faster locate. Locate was created in 1982, with the BSD and GNU Findutils versions deriving from the original implementation. Using locate is faster than find, but it requires having the database updated to find newly added files. The opposite can be specified using -basename.Locate is a Unix tool used to find files by name on the filesystem, which uses a prebuilt database of generated files (created using updatedb). w, -wholename Match only the whole path name against the specified patterns. V, -version Write information about the version and license of locate on standard output and exit successfully. s, -stdio Ignored, for compatibility with BSD and GNU locate. regex Interpret all PATTERNs as extended regexps. No PATTERNs are allowed if this option is used, but this option can be specified multiple times. r, -regexp REGEXP Search for a basic regexp REGEXP. q, -quiet Write no messages about errors encountered while reading and processing databases. S, -statistics Write statistics about each read database to standard output instead of searching for files and exit successfully. This option is designed for interoperability with the -null option of GNU xargs(1). 0, -null Separate the entries on output using the ASCII NUL character instead of writing each entry on a separate line. This causes broken symbolic links to be reported like other files. P, -nofollow, -H When checking whether files exist (if the -existing option is specified), do not follow trailing symbolic links. m, -mmap Ignored, for compatibility with BSD and GNU locate. If the -count option is specified, the resulting count is also limited to LIMIT. l, -limit, -n LIMIT Exit successfully after finding LIMIT entries. i, -ignore-case Ignore case distinctions when matching patterns. h, -help Write a summary of the available options to standard output and exit successfully. The opposite can be specified using -nofollow. This causes broken symbolic links to be omitted from the output. L, -follow When checking whether files exist (if the -existing option is specified), follow trailing symbolic links. e, -existing Print only entries that refer to files existing at the time locate is run. Note that a database can be read from the standard input only once. A database file name - refers to the standard input. An empty database file name is replaced by the default database. If more than one -database option is specified, the resulting path is a concatenation of the separate paths. DBPATH is a :-separated list of database file names. d, -database DBPATH Replace the default database with DBPATH. c, -count Instead of writing file names on standard output, write the number of matching entries only. b, -basename Match only the base name against the specified patterns. Option -A, -all Print only entries that match all PATTERNs instead of requiring only one of them to match. ดูข้อมูล stat ของ locate catalog $ locate -S Database /var/lib/mlocate/mlocate.db: 14,942 directories 132,761 files 7,168,592 bytes in file names 3,062,580 bytes used to store database Locate $ locate find /bin/btrfs-find-root /bin/findmnt /etc/apparmor.d/abstractions/apparmor_api/find_mountpoint /sbin/findfs /usr/bin/find
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |