A user creates /srv/reports/q3.csv and immediately runs locate q3.csv, which returns nothing. Running find /srv -name q3.csv lists the file. What explains the difference?
Show the answer
Correct answerB. locate searches a database built by updatedb, which has not yet indexed the new file
AWhy not this: locate matches substrings of the full path by default, and q3.csv would match; the name is not the problem.
BWhy this is right: Locate reads the index that updatedb builds, so a file created after the last update is missing until updatedb runs again.
CWhy not this: locate searches its whole database, which covers the filesystem, not just the home directory.
DWhy not this: find uses no database; it walks the directory tree each time it runs, which is why it sees the new file.
locate queries a prebuilt index that is usually refreshed on a schedule, so new files can be missing until updatedb runs. find walks the directory tree at run time, so it sees current files. Treating locate as real-time is the common misconception.