I need to archive and compress a large number of files but some of those files may have extended attributes whose content I don't want to lose.

My understanding is that zip doesn't do that. Is there something that does?

I believe that some versions of tar support extended attributes, but I'd prefer being able to access individuals files in the archive without having to decompress the entire archive as I have to with tar.

This is Linux only.


I'm using absolute paths here:

Use tar:

tar --xattrs cjf file.tar.bz2 /path/to/files

For extract a file:

tar xjf file.tar.bz2 path/to/files/dir/file-to-extract -C /


  • My understanding is that even if you put decompress and extract into the same tar command (xj), tar still needs to decompress the entire file before it can extract, or at least until it finds the file, as tar doesn't have a directory like zip does. Something I'd like to avoid. – Johannes Ernst Jul 16 '15 at 16:15
  • So you are looking for something like this: serverfault.com/questions/59795/… but with --xattrs right? – FarDarkMist Jul 17 '15 at 15:06
  • Actually just zip with --xattrs because zip otherwise does everything I need. – Johannes Ernst Jul 19 '15 at 0:36

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.