Extract file from tar home/
Aaron Konstam
akonstam at sbcglobal.net
Tue Jun 8 13:30:28 UTC 2010
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. You man have
to say:
tar xvzf bobg.tar.gz ./bobg/foo or maybe foo is not at the top of the
directory.
tar tvzf bobg.tar.gz will tell you that. Also you left out the z option
that you need to unzip.
--
=======================================================================
A language that doesn't affect the way you think about programming is
not worth knowing.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam at sbcglobal.net
More information about the users
mailing list