Cannot change the compression level for BZIP2 with Tar

476 views Asked by At

I need to change the compression level for BZIP2 compression with tar. I found that we can set the compression level and run the tar command to compress. I tried different compression levels using the following command, but it seems like BZIP2=-<compression level> does not change the compression level.

BZIP2=-1
tar -cjvf <output_file> <input_file>

How to do it correctly?

1

There are 1 answers

1
Mark Adler On

Since you tagged this "linux", I will assume that you are using GNU tar. Then you can give the compression command with options using -I:

tar -I="bzip2 -1" -cvf out.tar.bz2 files