After deleting dozens of *.tmp files from /var/log, you immediately run
$ locate '*.tmp'
and notice that many of the deleted paths still appear in the output. You do not have time to rebuild the locate database but need to run locate again so it lists only the files that still exist on the filesystem right now. Which single option should you add to the command?
locate normally consults a pre-built database, so it may report files that were removed after the last updatedb run. The -e (or --existing) option tells locate to verify that each path in the database still exists before printing it, removing stale results. The -c switch merely shows a count of matches, -b limits matching to the basename portion of each path, and -i makes the match case-insensitive; none of those options check whether the files currently exist, so deleted paths would still appear.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the '-e' option in the locate command?
Open an interactive chat with Bash
What does the locate database do and how is it updated?
Open an interactive chat with Bash
When should you use the 'locate' command instead of 'find'?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access