tldr/pages/common/cmp.md

21 lines
618 B
Markdown
Raw Normal View History

2016-02-23 01:29:35 +00:00
# cmp
2021-03-31 11:29:51 +01:00
> Compare two files byte by byte.
> More information: <https://www.gnu.org/software/diffutils/manual/html_node/Invoking-cmp.html>.
2016-02-23 01:29:35 +00:00
2022-07-30 13:05:02 +01:00
- Output char and line number of the first difference between two files:
2016-02-23 01:29:35 +00:00
2021-03-31 11:29:51 +01:00
`cmp {{path/to/file1}} {{path/to/file2}}`
2016-02-23 01:29:35 +00:00
2022-07-30 13:05:02 +01:00
- Output info of the first difference: char, line number, bytes, and values:
2016-02-23 01:29:35 +00:00
2022-07-30 13:05:02 +01:00
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
- Output the byte numbers and values of every difference:
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
- Compare files but output nothing, yield only the exit status:
`cmp --quiet {{path/to/file1}} {{path/to/file2}}`