Open In App

bzcmp command in Linux with examples

The bzcmp utility is used to invoke the cmp utility on bzip2 compressed files. All options specified are passed directly to cmp. As internally bzcmp calls cmp, We can pass the cmp command options to bzcmp.

Syntax:



bzcmp [cmp_options] file [file]

Example 1: Comparing two files as follows:

In the above example, bzcmp compares the file1.bz2 and file2.bz2 and returns the first-byte position where the data differs.

Example 2: Here, we will use bzcmp with Single parameter. Edit the compressed file file1.bz2 and replace the content from “GeeksForGeeks bzcmp example file1.” to “GeeksForGeeks bzcmp example file1 changed.” and execute the following command. bzcmp utility compares the file1.bz2 and file1.

Note: The output from cmp refers to temporary file name instead of a specified filename. To check the difference of contents in compressed(bz2) files you can use bzdiff command.

Article Tags :