Services and User Management

Which files does find /var/log -type f -mtime +7 match?

Show the answer

Correct answerA. Files last modified at least eight full days ago

AWhy this is right: find drops fractions of a day, so +7 needs an age of more than 7 whole days, which is 8 or more.

BWhy not this: A file 7.5 days old counts as 7 whole days, which is not more than 7, so it does not match.

CWhy not this: Files modified within the last seven days are what -mtime -7 matches.

DWhy not this: Files whose age rounds down to exactly 7 days are what -mtime 7 matches.

find -mtime counts age in whole 24-hour periods and drops any fraction, so +7 means more than 7 whole days, which is at least 8 days. A file modified 7.5 days ago counts as 7 days old and does not match.