Scroll to navigation

ZDIFF(1) User Commands ZDIFF(1)


zdiff - decompress and compare two files line by line


zdiff [options] file1 [file2]


zdiff compares two files and, if they differ, writes to standard output the differences line by line. A hyphen '-' used as a file argument means standard input. If any file given is compressed, its decompressed content is used. zdiff is a front end to the program diff and has the limitation that messages from diff refer to temporary file names instead of those specified.

'zdiff -v -V' prints the version of the diff program used.

The formats supported are bzip2, gzip, lzip, xz, and zstd.

zdiff compares file1 to file2. The standard input is used only if file1 or file2 refers to standard input. If file2 is omitted zdiff tries the following:

- If file1 is compressed, compares its decompressed contents with the corresponding uncompressed file (the name of file1 with the extension removed).
- If file1 is uncompressed, compares it with the decompressed contents of file1.[lz|bz2|gz|zst|xz] (the first one that is found).

Exit status is 0 if inputs are identical, 1 if different, 2 if trouble. Some options only work if the diff program used supports them.


display this help and exit
output version information and exit
treat all files as text
ignore changes in the amount of white space
ignore changes whose lines are all blank
use the context output format
same as -c but use <n> lines of context
try hard to find a smaller set of changes
ignore changes due to tab expansion
ignore case differences in file contents
process only the formats in <list>
don't read runtime configuration file
force the formats given (bz2,gz,lz,xz,zst)
show which C function each change is in
output only whether files differ
report when two files are identical
expand tabs to spaces in output
make tabs line up by prepending a tab
use the unified output format
same as -u but use <n> lines of context
verbose mode (for --version)
ignore all white space
output at most <n> print columns
output in two columns
set compressor and options for bzip2 format
set compressor and options for gzip format
set compressor and options for lzip format
set compressor and options for xz format
set compressor and options for zstd format


Report bugs to
Zutils home page:


Copyright © 2022 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later <>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


The full documentation for zdiff is maintained as a Texinfo manual. If the info and zdiff programs are properly installed at your site, the command

info zutils

should give you access to the complete manual.

January 2022 zutils 1.11