gzip: Advanced usage
1
1 4 Advanced usage
1 ****************
1
1 Multiple compressed files can be concatenated. In this case, ‘gunzip’
1 will extract all members at once. If one member is damaged, other
1 members might still be recovered after removal of the damaged member.
1 Better compression can be usually obtained if all members are
1 decompressed and then recompressed in a single step.
1
1 This is an example of concatenating ‘gzip’ files:
1
1 gzip -c file1 > foo.gz
1 gzip -c file2 >> foo.gz
1
1 Then
1
1 gunzip -c foo
1
1 is equivalent to
1
1 cat file1 file2
1
1 In case of damage to one member of a ‘.gz’ file, other members can
1 still be recovered (if the damaged member is removed). However, you can
1 get better compression by compressing all members at once:
1
1 cat file1 file2 | gzip > foo.gz
1
1 compresses better than
1
1 gzip -c file1 file2 > foo.gz
1
1 If you want to recompress concatenated files to get better
1 compression, do:
1
1 zcat old.gz | gzip > new.gz
1
1 If a compressed file consists of several members, the uncompressed
1 size and CRC reported by the ‘--list’ option applies to the last member
1 only. If you need the uncompressed size for all members, you can use:
1
1 zcat file.gz | wc -c
1
1 If you wish to create a single archive file with multiple members so
1 that members can later be extracted independently, use an archiver such
1 as ‘tar’ or ‘zip’. GNU ‘tar’ supports the ‘-z’ option to invoke ‘gzip’
1 transparently. ‘gzip’ is designed as a complement to ‘tar’, not as a
1 replacement.
1