Difficulty: Easy
Correct Answer: -atime +365
Explanation:
Introduction / Context:
System cleanup often targets files that have not been used recently. The find command offers predicates for selecting files by last access time (atime) and last modification time (mtime). Choosing the correct predicate avoids deleting files that are still in use.
Given Data / Assumptions:
Concept / Approach:
-atime n selects files accessed exactly n24 hours ago; -atime +n selects files accessed more than n24 hours ago; -atime -n selects files accessed less than n*24 hours ago. The corresponding predicates for modification are -mtime.
Step-by-Step Solution:
Verification / Alternative check:
To check matches without deleting, first run with -print. To combine with deletion and confirmation, use -ok rm {} \; or to delete directly, -exec rm {} \;. You can also pair with -mtime if you additionally require no recent modifications.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing atime with mtime; forgetting that find counts in 24-hour units, not calendar days; not quoting parentheses when combining predicates; and testing delete actions on the wrong directory tree.
Final Answer:
-atime +365
Discussion & Comments