Bird
0
0

You want to copy file1.txt to file2.txt but avoid overwriting if file2.txt exists. Which command fixes this error: cp file1.txt file2.txt?

medium📝 Debug Q7 of 15
Linux CLI - File and Directory Operations
You want to copy file1.txt to file2.txt but avoid overwriting if file2.txt exists. Which command fixes this error: cp file1.txt file2.txt?
Acp -r file1.txt file2.txt
Bcp -i file1.txt file2.txt
Ccp -f file1.txt file2.txt
Dcp -v file1.txt file2.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify option to prevent overwrite

    The -i option prompts before overwriting existing files.
  2. Step 2: Check other options

    -f forces overwrite, -r is for directories, -v is verbose only.
  3. Final Answer:

    cp -i file1.txt file2.txt -> Option B
  4. Quick Check:

    Prevent overwrite = use -i [OK]
Quick Trick: Use -i to avoid accidental overwrites [OK]
Common Mistakes:
MISTAKES
  • Using -f which forces overwrite
  • Using -r for files
  • Thinking -v prevents overwrite

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes