Recall & Review
beginner
What does the
diff command do in Linux?The
diff command compares two files line by line and shows the differences between them.Click to reveal answer
beginner
How do you use
diff to compare two files named file1.txt and file2.txt?Run
diff file1.txt file2.txt. It will show lines that differ between the two files.Click to reveal answer
beginner
What does the output starting with
< and > mean in diff?Lines starting with
< are from the first file, and lines starting with > are from the second file. They show what is different.Click to reveal answer
intermediate
What option can you add to
diff to ignore case differences?Use
diff -i file1.txt file2.txt to ignore case differences when comparing.Click to reveal answer
beginner
How can
diff help in real life?It helps you quickly see what changed between two versions of a file, like comparing two drafts of a letter or code.
Click to reveal answer
What does the
diff command compare?✗ Incorrect
diff compares two files line by line to show differences.
Which symbol in
diff output shows lines from the second file?✗ Incorrect
Lines starting with > come from the second file.
How do you ignore case differences when using
diff?✗ Incorrect
The -i option ignores case differences.
What will
diff file1.txt file2.txt show if files are identical?✗ Incorrect
If files are the same, diff shows no output.
Which command shows differences between two files?
✗ Incorrect
diff is used to compare files and show differences.
Explain how the
diff command helps you compare two text files.Think about how you spot changes between two versions of a note.
You got /3 concepts.
Describe a real-life situation where using
diff would be useful.Imagine you wrote a letter twice and want to see what you changed.
You got /3 concepts.