Locate (Unix) Explained

locate
Operating System:Unix and Unix-like
Genre:Command

locate is a Unix utility which serves to find files on filesystems. It searches through a prebuilt database of files generated by the updatedb command or by a daemon and compressed using incremental encoding. It operates significantly faster than [[Find (Unix)|find]], but requires regular updating of the database. This sacrifices overall efficiency (because of the regular interrogation of filesystems even when no user needs information) and absolute accuracy (since the database does not update in real time) for significant speed improvements, particularly on very large filesystems.

locate was first created in 1982.[1] The BSD and GNU Findutils versions derive from the original implementation.[2] Their primary database is world-readable, so the index is built as an unprivileged user. locate command is also included in MacOS.

mlocate (Merging Locate) and the earlier slocate (Secure Locate) use a restricted-access database, only showing filenames accessible to the user.[3] [4]

plocate uses posting lists. Like mlocate and slocate, it only shows files if find would list it.[5] Compared to mlocate, it is much faster, and its index is smaller.[6] [7]

See also

External links

Variants:

Notes and References

  1. Woods. James A.. 1983-01-15. Finding Files Fast. . 8. 1. 8–10. Usenix. 2016-03-27.
  2. Web site: Finding Files. 2012-11-17. GNU. Free Software Foundation. 2016-03-27. GNU locate and its associated utilities were originally written by James Woods, with enhancements by David MacKenzie..
  3. Web site: mlocate. https://web.archive.org/web/20060411074142/http://carolina.mff.cuni.cz/~trmac/blog/mlocate/. 2006-04-11. 2005. Miloslav Trmač. 2016-03-27. ...faster and does not trash the system caches as much...attempts to be compatible to GNU locate, when it does not conflict with slocate compatibility.. dead.
  4. Web site: Secure Locate. https://web.archive.org/web/20050507092723/http://www.geekreview.org/slocate/. 2005-05-07. 1999. Kevin Lindsay. 2016-03-27. ...will also check file permissions and ownership so that users will not see files they do not have access to.. dead.
  5. Web site: Gunderson . Steinar . plocate, a much faster locate . plocate.sesse.net . 23 February 2023 . en.
  6. Web site: Gunderson . Steinar . plocate(1). man.archlinux.org . Arch manual pages . 23 February 2023.
  7. Web site: plocate . Kali Linux . Kali Linux Tools . 23 February 2023 . English.