TAR help .....

Brad De Vries devriesbj at gmail.com
Thu Jan 22 13:52:43 PST 2009


On Thu, Jan 22, 2009 at 3:03 PM, Vu Pham <vu at sivell.com> wrote:
> Ben Duncan wrote:
>>
>> Ok, I have a tar file. When you tzr tvzf , you have a list that shows
>> something like :
>> ....
>> ......
>> export/usr1/thisdir/afile
>> export/usr1/thisdir/MYFILE
>> .....
>> ......
>> ....... (and so one ..)
>>
>> and you want to extract ONLY MYFILE and you want it extracted
>> in the directory you are in and NOT the WHOLE tree
>> How do you do that ?
>>
>
> To extract that single  file, I would do
>
> # tar xvzf yourfile.tar export/usr1/thisdir/MYFILE
>
> In this case your current directoy will have the whole
> export/usr1/thisdir/MYFILE there.
>
> Normally if I need to get some files, I will do like above to a temporary
> directory, and will mv the files I need.
>
>
> Vu

You could try using the --strip-path or --strip-components option.  It
appears, based on the "man" page, that it should exactly what you want
but I've never tried it.

Good luck,
Brad.



More information about the Linux-users mailing list