Multiple choice technology operating systems

How can we know two text files are identical?

  1. if the output of “cmp -s file1 file2” is not zero

  2. if the output of “cmp -s file1 file2” is zero

  3. if the output of “cmp -s file1 file2” is one

  4. if the output of “cmp -diff file1 file2” is zero

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The cmp utility compares two files byte-by-byte. The -s option runs it silently, returning an exit status of 0 if the files are identical, and 1 if they differ. Other options like -diff are invalid, and a non-zero or 1 exit status indicates differences or errors.