Open In App

bzdiff command in linux with examples

Last Updated : 15 May, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

bzdiff command in Linux is used to compare the bzip2 compressed files. Bzcmp and bzdiff are used to invoke the cmp or the diff program on bzip2 compressed files. All options specified are passed directly to cmp or diff. If only one file is specified, then the files compared are file1 and an uncompressed file1.bz2. If two files are specified, then they are uncompressed if necessary and fed to cmp or diff. The exit status from cmp or diff is preserved.

Synopsis:

bzcmp [ cmp_options ] file1 [ file2 ]
bzdiff [ diff_options ] file1 [ file2 ]

Example 1: Comparing two files as follows:

  • Create the two files as follows:

  • Now compressing both the files. After that compares both the files as follows:

    Here, in the above snapshot:

    “1c1” : Shows that first line in the file1.bz2 needs to be changed in order to match the lines of file2.bz2

    >” : Displays the lines in file1.bz2

    <” : Displays the lines in file2.bz2

Example 2: Here, we will use bzdiff with Single parameter. bzdiff utility compares the file1.bz2 and file1


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads