Showing entries with tag "tar".

Found 2 entries

ZSTD compression level with tar

I've been using zstd more and more for general compression. Using it with tar is pretty straight forward:

tar -cvpf -I zstd /tmp/etc.tar.gz /etc

This does not allow you to set the compression ratio however. After some digging I found an environment variable that controls the default compression level. If you run tar like this you can change the default compression level.

ZSTD_CLEVEL=19 tar -cvpf -I zstd /tmp/etc.tar.gz /etc

GZip has a similar variable, but it will allow any command line variable (not just compression ratio).

GZIP=-9 tar -cvzpf /tmp/etc.tar.gz /etc
Leave A Reply

Tar: Auto detecting the compression type

The Linux tar command has a cool feature to auto-detect the file compression based on the archive suffix.

-a, --auto-compress

use archive suffix to determine the compression program

This allows you to change file compressions by just changing the archive suffix:

tar -cvpaf /tmp/backup.tar.gz ~/
tar -cvpaf /tmp/backup.tar.bz2 ~/
tar -cvpaf /tmp/backup.tar.xz ~/

This saves you having to specify -z -j or -J respectively.

Leave A Reply