Bird
0
0

You need to remove files from /archive that were last modified over 15 days ago, but leave newer files intact. Which command safely accomplishes this?

hard📝 Application Q8 of 15
Linux CLI - Searching and Finding
You need to remove files from /archive that were last modified over 15 days ago, but leave newer files intact. Which command safely accomplishes this?
Afind /archive -mtime +15 -type f -delete
Bfind /archive -mtime -15 -type f -delete
Cfind /archive -mtime 15 -type f -exec rm {} \;
Dfind /archive -mtime +15 -type f -exec rm {} \;
Step-by-Step Solution
Solution:
  1. Step 1: Identify files older than 15 days

    The -mtime +15 option selects files modified more than 15 days ago.
  2. Step 2: Ensure only files are targeted

    The -type f restricts the search to regular files.
  3. Step 3: Remove files safely

    -exec rm {} \; executes the remove command on each found file safely.
  4. Final Answer:

    find /archive -mtime +15 -type f -exec rm {} \; -> Option D
  5. Quick Check:

    Check for files older than 15 days and confirm deletion command [OK]
Quick Trick: Use -mtime +N with -exec rm for files older than N days [OK]
Common Mistakes:
  • Using -mtime -15 deletes files modified within last 15 days
  • Using -mtime 15 finds files modified exactly 15 days ago
  • Using -delete without confirming file type may remove directories

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes