Bird
0
0

You run diff dir1 dir2 -r but get an error: diff: dir1: Is a directory. What is the problem?

medium📝 Debug Q7 of 15
Linux CLI - Viewing and Editing Files
You run diff dir1 dir2 -r but get an error: diff: dir1: Is a directory. What is the problem?
AYou used -r incorrectly; it should be before the directory names
BYou used -r but your diff version does not support it
CYou did not specify files inside the directories
DYou forgot to use the -r option for recursive directory comparison
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error

    The error says 'dir1: Is a directory' which means diff treats dir1 as a file.
  2. Step 2: Check option placement

    The -r option must come before directory names. If placed after, diff treats directories as files.
  3. Final Answer:

    You used -r incorrectly; it should be before the directory names -> Option A
  4. Quick Check:

    Place -r before directories for recursive diff [OK]
Quick Trick: Put -r before directory names to compare recursively [OK]
Common Mistakes:
  • Placing options after directory names
  • Not using -r for directories
  • Confusing files and directories

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes