Difficulty: Easy
Correct Answer: -l
Explanation:
Introduction / Context:
The cmp command is a binary comparator used to identify differences between two files. While its default output is minimal, certain options enable detailed byte-by-byte diagnostics, which are invaluable for debugging binary data or investigating subtle file corruption.
Given Data / Assumptions:
cmp
.
Concept / Approach:
cmp -l file1 file2
outputs each mismatch as a line containing the 1-based byte position, the byte value from the first file in octal, and the byte value from the second file in octal. This contrasts with the default behavior, which only reports the first difference and stops. Other options change exit behavior but do not produce this detailed listing.
Step-by-Step Solution:
-l
.Run: cmp -l file1.bin file2.bin
.Read each line: position and octal values for both files.Use the output to pinpoint exact byte offsets for patching or verification.
Verification / Alternative check:
Create two small files with known byte differences and compare them. Verify that the listed byte numbers and octal values match expectations. You can cross-check with od -An -tx1 -v
or xxd
for hex dumps.
Why Other Options Are Wrong:
-l
is correct.
Common Pitfalls:
Expecting 0-based positions (cmp uses 1-based); misreading octal values as decimal or hex; assuming cmp behaves like diff, which is line-oriented rather than byte-oriented.
Final Answer:
-l
mail
program's internal command set, which command forwards the current message to the specified user-list?
Discussion & Comments