zdiff command in Linux with Examples
The zdiff command in Linux is used to invoke the diff program on files compressed via gzip. All options specified are passed directly to diff.
Important Points:
- If only one file is specified, it is compared to the uncompressed contents of the specified file.
- If two files are specified, their contents (uncompressed if necessary) are fed to diff.
Syntax:
zdiff [ diff_options ] file1 [ file2 ]
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.

Recommended Posts:
- ZIP command in Linux with examples
- look command in Linux with Examples
- ssh command in Linux with Examples
- yes command in Linux with Examples
- fc Command in Linux with Examples
- dir command in Linux with examples
- less command in Linux with Examples
- Cat command in Linux with examples
- dc command in Linux with examples
- rm command in Linux with examples
- which command in Linux with examples
- until command in Linux with Examples
- gs command in Linux with Examples
- pwd command in Linux with Examples
- du command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



