Bird
0
0

Which command correctly compares two files named log1.txt and log2.txt?

easy📝 Conceptual Q2 of 15
Linux CLI - Viewing and Editing Files
Which command correctly compares two files named log1.txt and log2.txt?
Adiff log1.txt
Bdiff log1.txt log2.txt
Cdiff -c log1.txt
Ddiff -r log1.txt
Step-by-Step Solution
Solution:
  1. Step 1: Check the syntax for comparing two files

    The basic syntax for diff is diff file1 file2. diff log1.txt log2.txt matches this.
  2. Step 2: Analyze other options

    diff -c log1.txt misses the second file, diff log1.txt only has one file, and diff -r log1.txt misses the second file.
  3. Final Answer:

    diff log1.txt log2.txt -> Option B
  4. Quick Check:

    diff syntax for two files = diff file1 file2 [OK]
Quick Trick: Use diff followed by two filenames to compare them [OK]
Common Mistakes:
  • Using diff with only one file
  • Using directory options for files
  • Missing one filename in command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes