Update the filename database used by locate to reflect current files.
Excluded paths are managed by the system's updatedb configuration.
Which command should be used?
updatedb rebuilds the filename database used by locate. Exclusion paths are configured according to the implementation, commonly in /etc/updatedb.conf.
Detailed explanation
locate --updateIncorrect. locate is the query command and does not normally update its database with --update.
Incorrect. locate is the query command and does not normally update its database with --update.
updatedbCorrect. updatedb rebuilds the database searched by locate.
Correct. updatedb rebuilds the database searched by locate.
find --databaseIncorrect. find does not use a --database update operation.
Incorrect. find does not use a --database update operation.
whereis --updateIncorrect. whereis locates command files and manuals and does not rebuild locate data.
Incorrect. whereis locates command files and manuals and does not rebuild locate data.
Try it yourself
An example you can run in a temporary verification environment.
updatedb --helpExpected result
file name databaseを更新する使用法。実装によりコマンドが未導入の場合もあるKey points
- updatedb
- Locate database
- /etc/updatedb.conf
Notes
- Environment: GNU findutils/plocate系Linux
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.