A gzip (.gz) file typically contains a single member, but as per RFC 1952 it can contain many members.
2.2. File format
A gzip file consists of a series of "members" (compressed data sets)
GNU gzip and Apple gzip both appear to decompress multiple members to a single output file.
-
Create some test files
$ echo foo > foo.txt $ echo bar > bar.txt
-
Individually gzip them (which deletes the originals)
$ gzip foo.txt $ gzip bar.txt
-
Concatenate the invidiual gzip files into a combined gzip
$ cat foo.txt.gz bar.txt.gz > foobar.gz -
Delete the indiduals, leaving only the combined gzip
$ rm foo.txt.gz bar.txt.gz $ ls -l total 1 -rw-r--r-- 1 alex alex 64 Sep 5 10:48 foobar.gz
-
gunzip the combined, contents of both original files are written to a single uncompressed output file
$ gunzip foobar.gz $ ls -l total 1 -rw-r--r-- 1 alex alex 8 Sep 5 10:48 foobar $ cat foobar foo bar