Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With gzip you can do something like this:

gzip -c file1 > output.gz
gzip -c file2 >> output.gz
gzip -c file3 >> output.gz

and when you uncompress output.gz it will contain concatenated values of file1 file2 and file3.

Can the same be done reliably with bzip2? I can't find any mention of this in bzip2 docs, but maybe I'm just bad at reading/understanding?

share|improve this question
up vote 1 down vote accepted

bzip2 apparently works the same way as gzip for that operation, even using the same -c option. From the bzip2 man page:

       bunzip2 will correctly decompress a file which is the concatenation  of
       two  or  more compressed files.  The result is the concatenation of the
       corresponding uncompressed files.  Integrity testing (-t)  of  concate‐
       nated compressed files is also supported.
share|improve this answer
Thank you - missed this somehow. – user13185 Dec 15 '09 at 16:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.