Find newly created *.ready regular files under /srv/import without waiting for a database refresh.
Which command is appropriate?
find traverses the specified start path at execution time, so it sees current files independently of the locate database.
Detailed explanation
locate '/srv/import/*.ready'Incorrect. locate may miss a file created after the last database update.
whereis readyIncorrect. whereis locates command binaries and manuals.
find /srv/import -type f -name '*.ready'Correct. find /srv/import -type f -name '*.ready' searches the current tree.
which readyIncorrect. which searches PATH for an executable named ready.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); touch "$tmp/new.ready" "$tmp/skip.txt"; find "$tmp" -type f -name '*.ready' -printf '%f\n'; rm -rf "$tmp"Expected result
new.readyKey points
- find is a live traversal
- locate is a database snapshot
- -type f selects regular files
Notes
- Environment: GNU findutils 4.x / 一時ディレクトリ
- Use read-only lookups or disposable paths when verifying search behavior.
- Distribution-specific defaults should be checked before changing system configuration.
Foundation review
Place the operation
Combining -type f and -name makes the live traversal both current and specific.
Check the side effect
Limit the starting path to the required directory to avoid unnecessary traversal and permission noise.