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

In the "Why Xar" page of the Xar Google Code page it says:

Additionally, this means xar can use different compression methods for each file in the archive. For instance, it might not be a good idea to try to try to compress an already compressed file, but a large file might benefit greatly from using bzip2, whereas a small text file would be better served to use gzip.

I read the man page and it does not indicates how to do this. So, does anyone know how?

share|improve this question
The man page quite clearly states how to do this; searching the man-page for gzip would have given you your answer even if you just looked at it in a cursory manner. – tink Oct 17 '12 at 19:45
I take it that the OP wants to know how to use different compression methods for different files within the same archive. As far as I can tell, the man page does not answer this. – Ansgar Esztermann Oct 17 '12 at 20:09
Yes, Ansgar Esztermann, that was what I meant. And not only the xar man page does not indicate how to do this, but also their google code page. – NotFromBrooklyn Oct 18 '12 at 8:56
up vote 1 down vote accepted

You can't add them both in the same command line, as far as I can see – from the man page I interpret the functionality to include:

  • compressing files into the archive using various compression methods – this would have to be done individually, or in groups
  • decompressing them no matter whether they are in the same format or not

So you can have an efficient archive which only requires one command to extract all the contents.

share|improve this answer
So I should compress the file using one method and then add files with the other compression? Now as I'm typing this, it seems kinda logical. Thank you. – NotFromBrooklyn Dec 5 '12 at 7:19

I just read the "Why xar" blurb now, and downloaded the tar-ball to look at the man-page.

--compression gzip


--compression bzip2 

seems to do what you're asking?

share|improve this answer
This would work if you want only the compression bzip2 or gzip. What if I want both? I dont think "--compression gzip --compression bzip2" will work. – NotFromBrooklyn Oct 18 '12 at 8:59

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.