How it works...

Repeat after me—"locate is simple and needs to be updated, find works when in a bind, but powerful and cryptic and can break things." Lets continue and begin with the explanations:

  1. As mentioned previously, the locate command is a relatively simple search tool that uses a database as a backend, which contains an indexed list of all of the files for quick and efficient searches. Locate is not real-time unlike the find command, which searches everything as it exists at the time of execution (depending on the parameters provided to find). Locating stdio.h will produce several results depending on your system. However, when we run locate again, it does not know or contain any information regarding the /usr/filethatlocatedoesntknow.txt ...

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.