Is there a difference between zcat/gunzip -c and gunzip apart from the obvious one that one outputs it to the terminal and the other decompresses it to a file? I'm looking from a CPU utilization perspective. One of our clients mentioned that they would like to have a utility that can view the contents of zipped file without decompressing them. They also gave the example of gzcat, but I read up about gzcat and could not find definitive evidence that it is more efficient than gunzip . I could possibly see gzcat using lesser IO than gunzip. Are there any other improvements ? Any help is appreciated.


gunzip and gzcat are both convenience aliases for gzip -d and gzip -cd respectively. In fact, if you look you will see that they are implemented as shell scripts that call gzip with the appropriate options. So there is zero difference in CPU utilization or other performance characteristics.

The I/O difference could potentially find would depend upon whether or not output is being written to a file. But that doesn't really depend on how gzip is called since, for example, all of the following commands write their output to a file:

gunzip file.gz
gzcat file.gz >file
gzip -cd file.gz >file

If you don't write output to a file but to a pipe instead, for example like this:

gzcat file.gz | less
gzip -cd file.gz | mail root

Then you might notice a difference, but it depends on a lot of things such as how big the file is, how often and for how long the pipeline stalls, the amount of buffer memory in your system, etc...

  • Thanks a lot Celada :) This would really help make my case with them.
    – rahul
    Feb 7 '15 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.