locate cannot find a file you created a few minutes ago. Type the command, run as root, that rebuilds the database locate searches.
LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard easy
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
Answer
Type the answer.
Accepted answer
updatedb
Case sensitive — Linux is, and grading LS as ls would teach a falsehood.
Why
locate is fast because it never touches the filesystem at search time: it queries a database, normally under /var/lib/mlocate/ or /var/lib/plocate/, that updatedb builds by walking the tree. Distributions run updatedb from a daily cron job or systemd timer, so anything newer than the last run is invisible until you run it yourself. Its behaviour, including which paths and filesystem types to skip, is configured in /etc/updatedb.conf. find, by contrast, always searches live.
Where this comes from
- Cited
- LPI exam objective 104.7
- What it says
- Locate files with locate and maintain its database with updatedb.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 104 and space the ones you get wrong.