2

Trying to create a .gz archive - my_gz.gz - and add multiple files to it:

  $ gzip my_gz.gz file1.txt file12.txt

  gzip: can't stat: my_gz.gz: No such file or directory
Ivanari
  • 21
  • 1
  • 2
    Possible duplicate of [How to gzip multiple files into one gz file?](https://superuser.com/questions/334827/how-to-gzip-multiple-files-into-one-gz-file) – forest May 12 '18 at 09:49

1 Answers1

5

You cannot add multiple files using gzip because it is only a compression program, not an archiver. To compress multiple files, you would want to use tar with gzip:

tar czf archive.tar.gz file1.txt file2.txt

The z tells the archiver to automatically use gzip for compression. You could also tell it to use different compression algorithm. See the tar(1) manual page for more information on this.

forest
  • 1,344
  • 8
  • 19