Difficulty: Easy
Correct Answer: cmp
Explanation:
Introduction / Context:
File comparison is a routine task in system administration and software development. While 'diff' shows line-by-line textual changes, sometimes you need a raw, byte-level comparison to validate copies, downloads, or binary artifacts. Unix provides a minimalist tool for this exact purpose.
Given Data / Assumptions:
Concept / Approach:
The 'cmp' command compares files byte by byte. With no options, it is silent if files match and reports the first byte/line where they differ if not. It is ideal for verifying integrity after copies, especially for binaries, images, and archives where textual diffs are not meaningful.
Step-by-Step Solution:
Verification / Alternative check:
Compare 'sha256sum file1 file2' to confirm identical hashes. When both 'cmp' and hash agree, integrity is assured.
Why Other Options Are Wrong:
Common Pitfalls:
Using 'diff' for binaries (noisy/less useful), or forgetting that 'cmp' stops at the first difference (not a full difference report).
Final Answer:
cmp
Discussion & Comments