0
0
Linux CLIscripting~5 mins

diff for file comparison in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ATwo users
BTwo folders
CTwo files line by line
DTwo processes
Which symbol in diff output shows lines from the second file?
A&lt;
B&gt;
C#
D*
How do you ignore case differences when using diff?
A-i
B-v
C-r
D-c
What will diff file1.txt file2.txt show if files are identical?
AError message
BAll lines
CFile sizes
DNo output
Which command shows differences between two files?
Adiff
Bcat
Cls
Dgrep
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.