This question already has an answer here:

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?

marked as duplicate by don_crissti, Stephen Kitt, Jander, Raphael Ahrens, Ramesh Jul 30 '15 at 16:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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... – Lajdák Marek 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? – Lajdák Marek Jul 30 '15 at 14:24
  • @LajdákMarek xz can compress and decompress lzma files in most cases. See man xz for details... – Stephen Kitt 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.