locate
find by name, fastlocate looks a name up in a database of every path on the system, rebuilt once a day. That makes it far quicker than find, and also means it does not know about files created since the last update.
find walks the disk now; locate reads yesterday’s list — fast, but possibly out of date.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
Both the configuration file and its manual page match, because the name appears in each path.
A pattern with a wildcard must be quoted, or the shell expands it first.
The file exists, but the index was built before it did. locate prints nothing.
After a refresh the file appears. On most systems a timer runs updatedb once a day.
Switches
A switch changes how the command behaves. These are the ones used day to day; man locate lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-i- Ignore case.
-c- Count the matches instead of listing them.
-n NUM- Stop after NUM results.
-b- Match against the file name only, not the whole path.
-e- List only entries that still exist.
-r REGEX- Match a regular expression.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
locate -i readmeIgnores upper and lower case.
locate -b "\hosts"Matches the file name exactly, not any path containing the word.
locate -n 10 ".log"Stops after the first ten results.
locate -e report.txtLists only the entries that still exist on disk.
In cybersecurity
The index is a map of the whole filesystem, so who may read it matters.
Modern locate shows a user only the paths they could reach themselves, so the index does not leak the names of other users’ files.
Searching for id_rsa, .env or .kdbx across a machine takes a second. It is worth doing on your own systems first.
A file deleted today may still be listed, and one planted today will not be. Use find when the answer has to be current.