This tutorial explains Linux “zdiff” command, options and its usage with examples.
zcat – Expands a compressed file to standard output.
zcat uncompresses either a list of files on the command line or its standard input and writes the uncompressed data on standard output. zcat will uncompress files whether they have a .gz suffix or not.
zdiff [ diff_options ] file1 [ file2 ]
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
For optons refer to diff command tutorial
1. Simple Example
Check this: Linux Books | Programming MCQs
$ cat > file1.txt This is line one This is line two $ cat > file2.txt This is line 1 This is line two $ diff file1.txt file2.txt 1c1 < This is line one --- > This is line 1 $ gzip file1.txt file2.txt $ zdiff file1.txt.gz file2.txt.gz 1c1 < This is line one --- > This is line 1
2. zdiff with -c option of diff command
$ zcat file1.txt.gz abc def ghi $ zcat file2.txt.gz abc ghi klm $ zdiff -c file1.txt.gz file2.txt.gz *** /dev/fd/5 2013-12-26 11:08:57.341112539 -0800 --- - 2013-12-26 11:08:57.344296058 -0800 *************** *** 1,3 **** abc - def ghi --- 1,3 ---- abc ghi + klm
For all other usages, the zdiff command works just as the diff command with the difference that it takes .gz files as input.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.
- Practice Programming MCQs
- Buy Information Technology Books
- Apply for Programming Internship
- Apply for Linux Internship
- Buy Linux Books