Cory,
    To get the command you mentioned below to work you have to add a '-':

bzcat foo.bar.tar.bz | tar xf -

It may work without the 'f' but I am not sure.

Garl

Cory Petkovsek wrote:

> The tar's vary across versions of unix as well.
>
> There are some cool shortcuts with linux's tar, like using sdtin/stdout:
>
> bzcat kernel.tar.bz2 | tar x
>
> This works on linux.  However the tar on SunOS 5.8 (UofO CS dept) won't work with 
>stdin.  (At least I haven't figured out how to do it.)  To get the same result as 
>above, I have to do this:
>
> bzcat kernel.tar.bz2 > kernel.tar ; tar xf kernel.tar && rm kernel.tar
>
> Note executing:
> bzcat kernel.tar.bz2 | tar x            (or with gzip: tar xfz kernel.tgz)
> will leave the kernel.tar.bz2(.tgz) file as is, extract the files within, and 
>nowhere does the kernel.tar file appear.
>
> bunzip2 kernel.tar.bz2
> will delete the original archive, and leave 'kernel.tar', which is why I used bzcat 
>above.  Same thing with gunzip, unless some parameters are specified to say, don't 
>delete the original archive (but I haven't figured out what those are).  bzcat/zcat 
>will leave the file, outputting the uncompressed tar information to stdout (standard 
>out, which can then be redirected with > or | ).
>
> For sunos5.8, there is a bunch of monkeying with the file kernel.tar to produce the 
>same result as the linux command above.  This is due to sun's tar (seemingly) not 
>accepting stdinput and requiring the data in a file.
>
> bzip2 and gzip are two different compression techniques, incompatible with 
>eachother.  gzip has been incorporated into the linux (and others) tar command.  Tar 
>calls gzip I believe, rather than incorporating gzip code directly.
>
> for a gzipped file,
> zcat file.tgz | tar x
> is equivalent to
> tar xfz file.tgz
>
> trying to do this
> tar xfz file.tar.bz2
> WON'T WORK, at least until a new version of tar comes out.
>
> Here's something I learned from Pat, using tar and ssh to copy a host of files from 
>one computer to another via a secure channel:
>
> tar czp somedir/files | ssh -l frank computer.com "tar xzp"
> create an archive, passing 'files' through gzip, and retaining permissions (p), and 
>output that to standard out.  Redirect that to ssh, login as frank to computer.com 
>and run "tar xzp".  Extract info coming from standard in, passing it through gunzip, 
>and restoring the files and their permissions (p).
>
> But here's another way, part of the ssh package, scp:
> scp -Crq somedir [EMAIL PROTECTED]:
> secure copy with compression (-C) all subdirectories (-r) to computer.com.  Log in 
>as 'frank' and store files/subdirs in his home dir (:).  And don't display the 
>progress meter (-q).
>
> I think the tar version is much faster though:
> cory@cory-l:~$ time tar czp devl | ssh petersen-arne.com "tar xzp"
> real    0m37.957s
> cory@cory-l:~$ time scp -Crq devl [EMAIL PROTECTED]:
> real    1m19.797s
>
> Cory
>
> On Sun, Mar 11, 2001 at 06:46:13PM -0800, Dean Ridgway wrote:
> > Greetings All,
> >
> > >untar and unzip a .tgz .tar.gz or something similar:
> > >
> > >tar xfz <file.tar.gz>
> > >
> > >x means xtract, f means file, z means pass through gzip to decompress
> > >
> > >to create a .tar.gz file:
> > >tar cfz <file.tgz> <files to compress and tar>
> >
> > Note: on some versions of tar the order of the parameters is important.
> > I.e. the 'f' parameter (for file) needs to be followed by the actual file
> > name (example tar xzf <file.tar.gz> and tar czf <file.tgz>).
> >
> > Also the file extensions .tar.gz and .tgz are used interchangably.
> >
> >   /\-/\   Dean Ridgway               |  Two roads diverged in a wood, and I-
> >  ( - - )  InterNet [EMAIL PROTECTED]  |  I took the one less traveled by,
> >  =\_v_/=  FidoNet 1:357/1.103        |  And that has made all the difference.
> >           CIS 73225,512              |     "The Road Not Taken" - Robert Frost.
> > http://www.peak.org/~ridgwad/
> > PGP mail encouraged, finger for key: 28C577F3 2A5655AFD792B0FB 9BA31E6AB4683126

--
=============================================================================
Garl R. Grigsby
Senior Customer Applications Engineering - Analysis Team
-----------------------------------------------------------------------------
Structural Dynamics Research Corporation      Phone: (800)242-7372
TAO Americas Support Center                   FAX: (541)342-8277
1750 Willow Creek Circle                      Email:  [EMAIL PROTECTED]
Eugene, OR 97402                              Internet:  http://www.sdrc.com
=============================================================================
-FEA makes a good engineer great, and a poor engineer dangerous-
=============================================================================
PGP ID: 0xF2D845E7
PGP Fingerprint: 9C40 CB5E 1C51 CF58 E3F9  3F2C 8F1F F3EF F2D8 45E7
=============================================================================

Reply via email to