Re: Extract file from tar home/

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

 



On Tue, 2010-06-08 at 16:36 -0700, Suvayu Ali wrote:
> > To extract only a specific file:
> > $ tar xf bobg.tar.gz the/file/you/want
> >
> 
> I think the OP's worry is not whether it can be done, but he wants to 
> avoid the time and CPU cycles involved in the gunzip step. Since he
> has his entire home directory in the tarball, even extracting a single
> file requires tar to decompress the entire tarball before it can
> extract that one file.

Without looking at the source code one can't be sure, but I'd be
surprised if that were literally true. IOW I doubt that tar decompresses
everything to a temp file and then searches for the target. It should
only be necessary to decompress up to the position of the target file
(recall that tar originally meant "tape archiver", i.e. it's very
focussed on doing things in a single sequential pass). I assumed that
was what the OP wanted to do, and I believe the solution offered
achieves it. Furthermore, given that the Gzip compression algorithm is
stream-based, there cannot by definition be any substantially more
efficient way of doing it other than decompressing the stream up to the
point of interest.

The alternative archive method (compress each file and then tar up the
result), would be somewhat easier to extract in this specific case, but
at the cost of a poorer compression ratio. It's the old space/time
tradeoff once again.

poc

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux