Does gunzip work in memory or does it write to disk?

Posted by Ryan Detzel on Server Fault See other posts from Server Fault or by Ryan Detzel
Published on 2010-06-14T12:36:52Z Indexed on 2010/06/14 12:43 UTC
Read the original article Hit count: 256

Filed under:
|

We have our log files gzipped to save space. Normally we keep them compressed and just do

gunzip -c file.gz | grep 'test'

to find important information but we're wondering if it's quicker to keep the files uncompressed and then do the grep.

cat file | grep 'test'

There has been some discussions about how gzip works if it would make sense that if it reads it into memory and unzips then the first one would be faster but if it doesn't then the second one would be faster. Does anyone know how gzip uncompresses data?

© Server Fault or respective owner

Related posts about compression

Related posts about gzip