Software:locate (Unix)

From HandWiki
Revision as of 10:02, 9 February 2024 by Jport (talk | contribs) (correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

locate
Initial release1982; 42 years ago (1982)
Operating systemUnix and Unix-like
TypeCommand

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, 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

  • mdfind related command in MacOS

References

  1. Woods, James A. (1983-01-15). "Finding Files Fast". ;login: (Usenix) 8 (1): 8–10. https://archive.org/details/login-feb83/page/n7/mode/2up?view=theater. Retrieved 2016-03-27. 
  2. "Finding Files". Free Software Foundation. 2012-11-17. https://www.gnu.org/software/findutils/manual/html_node/find_html/Introduction.html#Introduction. "GNU locate and its associated utilities were originally written by James Woods, with enhancements by David MacKenzie." 
  3. Miloslav Trmač (2005). "mlocate". http://carolina.mff.cuni.cz/~trmac/blog/mlocate/. "...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." 
  4. Kevin Lindsay (1999). "Secure Locate". http://www.geekreview.org/slocate/. "...will also check file permissions and ownership so that users will not see files they do not have access to." 
  5. Gunderson, Steinar. "plocate, a much faster locate" (in en). https://plocate.sesse.net. 
  6. Gunderson, Steinar. "plocate(1)". Arch manual pages. https://man.archlinux.org/man/community/plocate/plocate.1.en. 
  7. "plocate" (in English). Kali Linux Tools. https://www.kali.org/tools/plocate/. 

External links

Variants:

  • plocate - Variant faster than mlocate, with a smaller index.
  • rlocate - Variant using kernel module and daemon for continuous updates.
  • KwickFind - KDE GUI frontend for locate
  • Locate32 for Windows - GPL'ed graphical Windows variant (no longer available)