Extract file from tar home/

Suvayu Ali fatkasuvayu+linux at gmail.com
Tue Jun 8 23:36:13 UTC 2010


On Tuesday 08 June 2010 04:26 PM, Patrick O'Callaghan wrote:
> On Tue, 2010-06-08 at 18:15 -0400, Bob Goodwin wrote:
>> Yes, and this is essentially what I did except I tar'd the entire
>>      /home/bobg/ directory into one big lump. My question was could I
>> go in and unzip individual files. It seems that can't be done easily.
>
> You don't seem to have grokked the previous answers (mine and others)
> including the one you're replying to. What you want to do is easy and
> completely standard. The quoted answer tells you exactly how to do it.
> Once more with feeling:
>
> To extract the whole thing:
> $ tar xf bobg.tar.gz
> (or tar xvf to if you want to watch it working)
>
> 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.

I think the only solution in this case is to do

$ gunzip bobg.tar.gz

and keep the resulting bobg.tar file in some easy to access area. A 
subsequent

$ tar xf bobg.tar /path/to/my/file

should be fast and easy to do.

> poc
>

Apologies if my understanding of the OP's problem is incorrect.
-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list