Команда zdiff в Linux с примерами
Опубликовано: 16 Февраля, 2022
Команда zdiff в Linux используется для вызова программы diff для файлов, сжатых с помощью gzip . Все указанные параметры передаются напрямую в diff .
Важные моменты:
- Если указан только один файл, он сравнивается с несжатым содержимым указанного файла.
- Если указаны два файла, их содержимое (при необходимости несжатое) передается в diff .
Синтаксис:
zdiff [diff_options] файл1 [файл2]
Example 1: In the below example, zdiff compares file1.gz and file2.gz and returns the lines in which the difference occurs.
- Creating two files and compressing them.

- Now comparing the two given files.

Example 2: Command with only one parameter. In the below example, file1.gz is compared with its uncompressed contents i.e., file1 and returns the lines in which the difference occurs.
- Replacing the contents of file1 while keeping the file1.gz same from Example 1.

- Now executing the zdiff command with single parameter.
