Bird
0
0

You want to delete all directories named cache inside your home folder and its subfolders. Which command achieves this?

hard📝 Application Q8 of 15
Linux CLI - File and Directory Operations
You want to delete all directories named cache inside your home folder and its subfolders. Which command achieves this?
Afind ~ -type d -name 'cache' -exec rm -r {} +
Brmdir -r ~/cache
Crm -r cache
Drm -r ~/cache
Step-by-Step Solution
Solution:
  1. Step 1: Understand the need to find multiple directories recursively

    To delete all 'cache' directories anywhere under home, you must search recursively.
  2. Step 2: Use find command with rm -r

    find ~ -type d -name 'cache' -exec rm -r {} + finds all directories named 'cache' and removes them recursively.
  3. Final Answer:

    find ~ -type d -name 'cache' -exec rm -r {} + -> Option A
  4. Quick Check:

    Use find with rm -r to delete multiple directories [OK]
Quick Trick: Use find with rm -r to delete multiple directories by name [OK]
Common Mistakes:
  • Using rm -r on a single path only
  • Using rmdir with -r option
  • Not searching recursively for all matches

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes