Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an option like -u instead of the file name.
Forgetting to specify the first file.
✗ Incorrect
The diff command compares two files. The first argument should be the first file name, here 'file1.txt'.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The -u option shows unified diff format, which is easier to read.
3fill in blank
hardFix 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'
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.
✗ Incorrect
The -r option tells diff to compare directories recursively.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using -u or -c which show detailed diffs, not just if files differ.
Omitting -r when comparing directories.
✗ Incorrect
The -r option compares directories recursively, and -q shows only if files differ without details.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is for directories, not files.
Omitting -i when ignoring case is needed.
✗ Incorrect
The -i option ignores case differences, -u shows unified diff, and -w ignores all whitespace differences.