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 -I zstd -cvpf /tmp/etc.tar.zst /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 -I zstd -cvpf /tmp/etc.tar.zst /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

Update: You can also use ZSTD_NBTHREADS to use more CPU cores.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.145.15.205
To prevent spam please submit by clicking the kitten: