A file created a few seconds ago does not appear in a locate search.
The path and pattern are correct.
What is the most likely explanation?
locate searches a prebuilt filename database, so changes made after the last database update may not appear yet.
Detailed explanation
Correct. The locate database may not have been updated since the file was created.
Correct. The locate database may not have been updated since the file was created.
Incorrect. locate can search files as well as directories.
Incorrect. locate can search files as well as directories.
Incorrect. locate can search the database for paths across the system.
Incorrect. locate can search the database for paths across the system.
Incorrect. locate supports pattern matching beyond exact names.
Incorrect. locate supports pattern matching beyond exact names.
Try it yourself
An example you can run in a temporary verification environment.
locate --helpExpected result
file name databasesを検索する使用法。実装によりコマンドが未導入の場合もあるKey points
- It searches an index
- It is fast
- The index can be stale
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.