compressiongziptar

With GNU GZIP environment variable deprecated, how to control ZLIB compression via tar?


Currently I have a script that sets compression using the GZIP environment variable.

With gzip 1.8 I get a warning:

warning: GZIP environment variable is deprecated; use an alias or script

How should tar be invoked so the compression level be set?

Current command:

GZIP=-9 tar -zcf ... files to compress ...


Solution

  • You can specify the compression program using: -I / --use-compress-program=COMMAND.

    So the original command:

    GZIP=-9 tar -zcf ... files to compress ...

    Becomes:

    tar -I 'gzip -9' -cf ... files to compress ...

    From this answer.