Bird
0
0

You want to delete files in /backup that were modified more than 10 days ago but keep files modified within 10 days. Which command correctly does this safely?

hard📝 Application Q15 of 15
Linux CLI - Searching and Finding
You want to delete files in /backup that were modified more than 10 days ago but keep files modified within 10 days. Which command correctly does this safely?
Afind /backup -mtime +10 -delete
Bfind /backup -mtime +10 -exec rm {} \;
Cfind /backup -mtime 10 -delete
Dfind /backup -mtime -10 -exec rm {} \;
Step-by-Step Solution
Solution:
  1. Step 1: Identify files older than 10 days

    -mtime +10 selects files modified more than 10 days ago.
  2. Step 2: Use safe deletion option

    -delete deletes files directly; it's safer and simpler than -exec rm which can be error-prone.
  3. Step 3: Check other options

    -mtime -10 deletes recent files (wrong), -mtime 10 deletes files exactly 10 days old (not older), and -exec rm works but less safe than -delete.
  4. Final Answer:

    find /backup -mtime +10 -delete -> Option A
  5. Quick Check:

    Use +N with -delete to remove files older than N days [OK]
Quick Trick: Use -mtime +N with -delete to remove files older than N days [OK]
Common Mistakes:
  • Using -mtime -10 deletes recent files instead of old
  • Using -mtime 10 deletes only files exactly 10 days old
  • Using -exec rm without care can cause errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes