Re: Extract file from tar home/

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

 



On Tue, 2010-06-08 at 08:30 -0500, Aaron Konstam wrote:
> On Mon, 2010-06-07 at 17:57 -0430, Patrick O'Callaghan wrote: 
> > On Mon, 2010-06-07 at 15:08 -0700, jack craig wrote:
> > > it only makes sense, zip deflated the individual files and tar is 
> > > ignorance of that requirement.
> > > hence the untar, then unzip.
> > 
> > [Please don't top-post on this list. See the Guidelines.]
> > 
> > There is nothing in the OP's message to indicate how the tar file was
> > created. The usual way is similar to:
> > 
> > tar cf - dir | gzip > dir.tar.gz (or dir.tgz, it's irrelevant).
> > 
> > (Note gzip, not zip). The advantage of doing it this way is that it will
> > almost always give a smaller final file, as the compression phase can
> > utilize redundancy over the whole tar file and not one component at a
> > time.
> > 
> > If this is in fact what the OP did, then the current version of tar can
> > read it directly without an intermediate gunzip stage. In fact it can
> > detect the compression automatically without the need for a specific
> > command option. Thus:
> > 
> > tar tvf bobg.tar.gz
> >         will list all the files, and
> > tar xvf bobg.tar.gz foo
> >         will extract file "foo"
> > 
> > poc
> > 
> 
> Whether the above will work depends on how it was tarred.

The first paragraph of my reply gives an example, which is the implied
context of the rest.

>  You man have
> to say:
> tar xvzf bobg.tar.gz ./bobg/foo or maybe foo is not at the top of the
> directory.

Any Unix/Linux app that manipulates files clearly has to refer to them
with pathnames. It hardly seems necessary to point it out every time. In
fact it would be extraordinary if it wasn't the case.

> tar tvzf bobg.tar.gz will tell you that. Also you left out the z option
> that you need to unzip.

My point is that you *don't* need the z option. tar understands it
anyway (this is a feature from a year or two ago). Try it.

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]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux