GZip every file separately


Question

How can we GZip every file separately?

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

1
31
1/3/2018 11:01:57 AM

Accepted Answer

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.
63
1/3/2018 11:00:26 AM

Easy and very fast answer that will use all your CPU cores in parallel:

parallel gzip ::: *

GNU Parallel is a fantastic tool that should be used far more in this world where CPUs are only getting more cores rather than more speed. There are loads of examples that we would all do well to take 10 minutes to read... here


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon