It is a rather theoretical question but is there some (not too obscure) incremental archive format allowing to append to an existing archive using >> or to join several archives using a simple cat?

archive file1 file2 > backup
archive file3 file4 >> backup
cat first.archive second.archive > full.archive

I initially thought about cpio. But it uses a special TRAILER!!! marker at the end of the initial archive, so if you catenate two CPIO archives, the second one is never read. Unless I missed some option?

  • Create your own format? Oct 2, 2018 at 12:29
  • shar ;-)
    – mosvy
    Oct 2, 2018 at 12:52
  • @mosvy I thought about shar, but I was not quite sure. Could you elaborate? Oct 2, 2018 at 13:10
  • 1
    CPIO is even worse, when you place a file names TRAILER!!! in the filesystem, cpio will stop to read the archive once it sees this file in the archive ;-)
    – schily
    Oct 2, 2018 at 13:39
  • Yes @schily I was aware of that "limitation". That would leave me with the tar/ustar file format--but if I'm not too wrong, the end of the archive is marked by at least two 512-bytes zero blocks. The "at least" part makes that trailer hard to remove using the standard tools. Or it isn't? Oct 2, 2018 at 15:15

2 Answers 2


man tar:

   -A, --catenate, --concatenate
          Append archive to the end of another archive.  The arguments are
          treated as the names of archives to append.  All  archives  must
          be  of the same format as the archive they are appended to, oth‐
          erwise the resulting archive  might  be  unusable  with  non-GNU
          implementations of tar.  Notice also that when more than one ar‐
          chive is given, the members from archives other than  the  first
          one  will  be  accessible in the resulting archive only if using
          the -i (--ignore-zeros) option.

          Compressed archives cannot be concatenated.
  • I know that. But that's not my question: I'm not looking for an archive utility allowing to add files to an existing archive. I'm looking for an archive file format that supports file-level concatenation. Oct 2, 2018 at 11:32

Not exactly what I was looking for, but it is rather trivial to remove the 280-byte cpio trailer to allow archive concatenation:

find file1 file2 | cpio -o > part1.cpio
find file3 file4 | cpio -o > part2.cpio

head -c-280 part1.cpio | cat - part2.cpio > full.cpio

I still wonder if there are some archive file format not using a trailer block.

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.