Bird
0
0

Which of the following is the correct syntax to delete all .bak files using find with -exec?

easy📝 Syntax Q3 of 15
Linux CLI - Searching and Finding
Which of the following is the correct syntax to delete all .bak files using find with -exec?
Afind /path -name '*.bak' -exec rm {} \
Bfind /path -name '*.bak' -exec rm {}
Cfind /path -name '*.bak' -exec rm {} ;
Dfind /path -name '*.bak' -exec rm {} \;
Step-by-Step Solution
Solution:
  1. Step 1: Understand the correct termination of -exec

    The -exec command must end with \; to signal the end of the command.
  2. Step 2: Check the command correctness

    find /path -name '*.bak' -exec rm {} \; correctly uses rm with {} placeholder and ends with \;.
  3. Final Answer:

    find /path -name '*.bak' -exec rm {} \; -> Option D
  4. Quick Check:

    Correct syntax with rm and \; = A [OK]
Quick Trick: Always end -exec commands with \; to avoid errors [OK]
Common Mistakes:
  • Missing \; at the end
  • Using ; without escape
  • Leaving out {} placeholder

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes