How can I set the compression level for this command?

tar --lzma -cf files/compressed/lzma/archive.lzma -C files/original/ .

With --bzip I just use:

BZIP2=-9 tar --bzip2 -cf files/compressed/bzip2//archive.tar.bz2 -C files/original/ .

but with the --lzma option LZMA=-9 doesn't work.

Is this enviroment variable name incorrect? Where can I get the correct variable name?

  • Why duplicate? I did not ask how to set compress setting the XZ but lzma... I do not want write command by pipelines but only tar... Jul 30 '15 at 14:07
  • Retracted it, yours that that have the same answer, so I firstly think it duplicated.
    – cuonglm
    Jul 30 '15 at 14:10
  • @cuonglm You was right is a duplicate - sorry. But i don't understand in tar --help is parameter --xz and --lzma with description filter the archive through xz they are not different comprimation methods? Jul 30 '15 at 14:24
  • @LajdákMarek xz can compress and decompress lzma files in most cases. See man xz for details... Jul 30 '15 at 14:28

If your version of tar uses xz for --lzma (which is likely, even Debian 6 used that), you can use the XZ_OPT variable:

XZ_OPT=-9 tar --lzma ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.