Re: Extract file from tar home/

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

 



On 06/08/2010 06:51 PM, Bob Goodwin wrote:
> On 08/06/10 19:26, 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)
>>
> Yes, this works, has not been a problem.
>> To extract only a specific file:
>> $ tar xf bobg.tar.gz the/file/you/want
>>
> For whatever reason I haven't been able to make that work. I will pursue
> that effort again later. I haven't been able to devote as much time to
> this today as I need to.

Several things can trip you up:

You have to ask for the file exactly as it was stored in the archive.
If that is "./the/file/you/want", then you have to include that "./"
prefix.

If you ask for just files and not the directories that contain them,
or if the archive doesn't contain entries for the directories, then
the target directories must already exist.

And finally, if the archive contains files that had multiple hard
links, the contents of each of those files was stored only the first
time its inode was encountered unless the "--hard-dereference"
was used when the archive was created.  If you ask to extract a
subsequent link and not the first, the extraction will fail**, and
there is no way other than the error message from the extract or
doing "tar -tv" over the whole archive to determine which link came
first.  That can be a major PITA if you're reading a large archive,
especially if it's from a slow tape. (BTDT)

** Or worse, the name gets linked to an existing file with content
    different from what was stored under that name in the tar
    archive.  There is no error or warning when that occurs.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.

-- 
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