As far as I can tell, XZ is a container that uses the LZMA2 algorithm (i.e. extended LZMA); but e.g.

$ xz foo/

complains about foo/ being a directory. So presumably the correct way to preserve directories with XZ is with tar; then what is the difference between tar --lzma and tar --xz?

(Note that I do explicitly want ownership and permissions preserved, which is why I'm not just using 7z.)


This options control which external binary tar calls for compressing its data stream: lzma and xz respectively. While both of them uses the same compression algorithm by default, xz is considered more up-to-date and feature rich, with lzma being somewhat legacy tool. Modern version of xz-utils provides both commands, with lzma being an 'alias' for xz --format=lzma (man xz).

  • So with modern xz-utils, there's effectively no difference? – Andrew Apr 12 '13 at 3:59
  • I believe so, at least when using with tar. xz archives can be concatenated, while lzma cannot (limitations of container format) — that's the only notable difference for me, applying xz was used with lzma compression. – artyom Apr 12 '13 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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