0
0
Linux CLIscripting~10 mins

diff for file comparison in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to compare two files named file1.txt and file2.txt using the diff command.

Linux CLI
diff [1] file2.txt
Drag options to blanks, or click blank then click option'
Afile1.txt
B-u
C-r
D--help
Attempts:
3 left
💡 Hint
Common Mistakes
Using an option like -u instead of the file name.
Forgetting to specify the first file.
2fill in blank
medium

Complete the code to show unified diff output between file1.txt and file2.txt.

Linux CLI
diff [1] file1.txt file2.txt
Drag options to blanks, or click blank then click option'
A--brief
B-c
C-r
D-u
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is for recursive directory comparison.
Using --brief which only shows if files differ, not the details.
3fill in blank
hard

Fix the error in the command to compare directories dir1 and dir2 recursively.

Linux CLI
diff [1] dir1 dir2
Drag options to blanks, or click blank then click option'
A-r
B-u
C-c
D-q
Attempts:
3 left
💡 Hint
Common Mistakes
Using -u or -c which are for file diffs, not recursive directory comparison.
Using -q which only reports if files differ, no details.
4fill in blank
hard

Fill both blanks to create a command that shows only if files differ between dirA and dirB recursively.

Linux CLI
diff [1] [2] dirA dirB
Drag options to blanks, or click blank then click option'
A-r
B-q
C-u
D-c
Attempts:
3 left
💡 Hint
Common Mistakes
Using -u or -c which show detailed diffs, not just if files differ.
Omitting -r when comparing directories.
5fill in blank
hard

Fill all three blanks to create a command that ignores case differences and shows unified diff between fileA.txt and fileB.txt.

Linux CLI
diff [1] [2] [3] fileA.txt fileB.txt
Drag options to blanks, or click blank then click option'
A-i
B-u
C-w
D-r
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is for directories, not files.
Omitting -i when ignoring case is needed.