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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux