Bird
0
0

Which of the following is the correct syntax to copy a directory named docs and all its contents to backup?

easy📝 Syntax Q12 of 15
Linux CLI - File and Directory Operations
Which of the following is the correct syntax to copy a directory named docs and all its contents to backup?
Acp -r docs backup
Bcp -d docs backup
Ccp docs backup
Dcp -f docs backup
Step-by-Step Solution
Solution:
  1. Step 1: Identify the option to copy directories recursively

    The -r option tells cp to copy directories and their contents recursively.
  2. Step 2: Check other options

    -d is for preserving links, -f forces overwrite but doesn't copy directories recursively, and no option copies only files.
  3. Final Answer:

    cp -r docs backup -> Option A
  4. Quick Check:

    Use -r to copy folders [OK]
Quick Trick: Use -r to copy folders and contents [OK]
Common Mistakes:
  • Omitting -r when copying directories
  • Using -d or -f incorrectly
  • Assuming cp copies folders without options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes