Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)

share|improve this question
up vote 4 down vote accepted

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).

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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