Re: [mu ANNOUNCE] muLinux v7.0 is out: tar and the minus sign

From: Gerhard Thimm (
Date: Wed Nov 10 1999 - 07:39:49 CET

Vieira Netto schrieb:
> Hello World of MuLinux!
> Help/archiving. It says that -z is illegal:
> /# cat iptraf.tgz | gzip -dc | tar -zxf
> tar: illegal option -- z
> Usage: tar -c[bfvw] device block filename..
> tar -r[bvw] device block [filename...]
> tar -t[vf] device
> tar -u[bvw] device block [filename...]
> tar -x[flmovw] device [filename...]

Most tar's I know do not support the z option, which activate a
compression or zip tool. I normally use pipelinig like this:
cat anarchive.tgz | gunzip | tar xf -

> I just followed the instructions except a minus sign at the end of line.
> What is it for???

The short answer, the minus sign is a place holder for pipe-archivs.

And a longer answer, I hope not to long :-)
This is one of that things, I very like in .*nix (sorry, grep notation:)
the standard i/o-channels (stdin and stdout in k&r|ansi-c-notation)

OK. You use the minus sign if the archive-data comes from stdin, like
the above "anarchiv.tgz-example and not from a file. If you write the
archive into a pipe the minus sign represents the stdout-channel, like
tar cf - | gzip >anotherarchiv.tgz

One of my favorites command-pipelines is this:

cd fromdir; tar cf - . | (cd todir; tar xfvBp - )

which copies a whole fromdir-tree, much more reliable than
 cp -r fromdir todir. The first minus sign means stdout, the 2nd stdin.
The dot (.) after the first minus sign means the current dir. Without
the v-option the command works silent.

The problem with tar paramaters is, that the first parameter means the
archive, the folling ones the files and dirs to colllect or extract
to/from that "first-paramater-archiv". look at this:
tar cf - README *.c | gzip > arc.tgz
Whitout the minus sign it is difficult to realize the meaning of README.
Is it a file to-tar-it or is it the name of the archive.

(Because the shell handles the pipe-sign (|), the tar command as no
idea, that you would like to pipe the output)
> I live in Brasil and I speak Brasilian Portuguese, a little bit different
> then that spoken in Portugal. Excuse me if my english is not correct.
as a swiss a avoid to correct something, a fight which my own english :)
> Please, "ask me" if you cant understand anything.
> See you later friends,
> Um abrašo,

To unsubscribe, e-mail:
For additional commands, e-mail:

This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:12 CET