Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GZip every file separately

Tags:

linux

bash

gzip

How can we GZip every file separately?

I don't want to have all of the files in a big tar.

like image 455
Tonio Avatar asked Nov 24 '09 18:11

Tonio


People also ask

How do I zip multiple files with gzip?

To compress multiple files at once using gzip , we use the gzip command with -d option followed by file names to be decompressed separated by a space. It decompresses the files main. py. gz , file.

Can gzip contain multiple files?

2 Answers. Unlike ZIP, RAR or 7-Zip, for example, gzip can only compress one file. As you've already noted, there is the tar program which can serialize multiple files into one which makes them ready for gzip .


1 Answers

You can use gzip *


Note:

  • This will zip each file individually and DELETE the original.
  • Use -k (--keep) option to keep the original files.
  • This may not work if you have a huge number of files due to limits of the shell
  • To run gzip in parallel see @MarkSetchell's answer below.
like image 104
Courtney Faulkner Avatar answered Sep 28 '22 03:09

Courtney Faulkner