Extract file from tar home/

g geleem at bellsouth.net
Mon Jun 7 23:20:11 UTC 2010


Bob Goodwin wrote:
> On 07/06/10 17:52, Luc MAIGNAN wrote:
>> Le 07/06/10 23:48, Bob Goodwin a écrit :
>>    
>>> I have /home/bobg/ tar'd to "bobg.tar.gz." Can I extract individual
>>> files or directories without unzipping the entire 17 gigs?
>>
>> tar -xzvf bobg.tar.gz file_to_extract
>>
>> "man tar" is your friend...
> 
> Yes I've been working with "man tar" and Google so thought I would
> come to the place of last resort.
>
> AS I suspected it probably has to be unzipped first but that's ok,
> just a thought.

bob,

as luc maignan points out, there is a way to get your single file.

my concerns are with fact that if a file is broken, tar stops. i would
hope that this has changed.

i do not know as i use 'cpio' scripts for archiving, because cpio will
skip a broken file.

plus, cpio works great with tape archiving, usb memory sticks, usb drives.


to archive;
  find $1 -depth | sort | cpio -o -aBcv > $2.cpio

to un-archive;
  cpio -i -Bcv < $1.cpio

wherein, $1 = source, $2 = target.


which could, i imagine, as i have never tried, be modified for zip
compression by using,

to archive;
  find $1 -depth | sort | zip -** | cpio -o -aBcv > $2.cpio

to un-archive;  [not sure which, would have to try to see]
  cpio -i -Bcv < $1.cpio | grep filename.zip | zip -**
 or
  cpio -i -Bcv < $1.cpio | zip -** filename.zip

where '-**' would be your zip arguments.


see: man find, man sort, man cpio, man zip, man tar.


something i would suggest;

zipping paths to several zip files before tarring.

archiving to several files in event there is a non recoverable
corruption so all would not be lost.

apply old adage about 'all your eggs in one basket'.


hth.

-- 

peace out.

tc,hago.

g
.

****
in a free world without fences, who needs gates.
**
help microsoft stamp out piracy - give linux to a friend today.
**
to mess up a linux box, you need to work at it.
to mess up an ms windows box, you just need to *look* at it.
**
learn linux:
'Rute User's Tutorial and Exposition' http://rute.2038bug.com/index.html
'The Linux Documentation Project' http://www.tldp.org/
'LDP HOWTO-index' http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
'HowtoForge' http://howtoforge.com/
****

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 545 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20100607/e4a0b9c1/attachment.bin 


More information about the users mailing list