[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Extracting indiviual files or directories from XYZ.tar.xz - Possible?



On Thu, Aug 07, 2025 at 07:00:31 -0500, Richard Owlett wrote:
> My questions:
>   1. Can individual files or directories be extracted from XYZ.tar.xz ?

Yes.

>   2. Is there a compressed format that makes above convenient?

If you plan to do this repeatedly, the .zip format is a superior
choice.

A tar archive is meant to be written to tape (the "t" literally stands
for "tape"), so it's a sequential read archive.  You can't jump
directly to the file you want; all you can do it keep reading the
archive from the beginning until you reach the desired file.  Compressing
it doesn't change this; you still have to read the whole thing until
you find your file.

The .zip format, on the other hand, has an index.  It's a random
access archive of individually compressed files, which means the
compression ratio is not as good, but *access* is much faster.  You
(meaning the unzip program or whatever software you use) simply open
the .zip file, read the index to find where your file begins, seek
to that location, retrieve your compressed file, and then uncompress
it.

Of course, the *best* way to retrieve individual files repeatedly is
not to compress or archive them in any way.  Just put the files in
a directory.  Given the size of disk drives these days, you should
think carefully about whether you really need to compress/archive these
files, if you're going to be using them a lot.


Reply to: