[PLUG] tar help

Rogan Creswick creswick at gmail.com
Fri May 4 05:04:14 UTC 2007


On 5/3/07, Kenneth B. Hill <ken at scottshill.com> wrote:
> I hope that I am replying to the list correctly; I get them in a
> bundle once or twice a day.

Generally, it's preferred to reply in-line, so we can tell what you're
replying to.  If you become active in the group you may consider
switching from digest mode to getting each message separately.  Any
email client worth it's salt (and many, many clients that *aren't*)
will be able to filter email from the list in a way that makes the
bulk of email manageable.  It helps the rest of us with threading, at
the very least. (since digest messages usually break email threading)

> What is the difference between tar and
> zip (or gzip or gz).

gzip compresses single files -- as far as I know, gzip will not create
a compressed archive of a number of files on it's own.  "zip" is
another tool entirely (although it accomplishes a *similar* function.
More on zip later.)

tar does the other half of what most people need -- it combines files
into one, but does not compress them.  (There is a *lot* more to tar
than that, but I'm not the person to go into it.)

tar and gzip follow the unix philosophy pretty closely:  Do one task,
and do that task very well.  In order to compress a whole host of
files, you need to tar them, and then gzip the result.  Now days, tar
is capable of calling gzip (or bzip2) directly, so you don't need
multiple commands, but in the past, you needed to pipe tar to gzip, or
run tar, and then manually gzip the result.  This is at least part of
the reason you see so many files ending in .tar.gz -- they are tar's
(files created by tar) that have been gziped (hence the .gz).
Slackware packages use the more terse .tgz, which may have other
connotations, like being compatible with the slackware "install"
utilities, but under the hood these files are also tar.gz's.

You could think of tar as a bag to hold things, and gzip as
compression straps that make it smaller.  Without the bag, the
contents would just go squirting all over the place.

zip does the task of both tar and gzip, but it's not as unix-y.  IIRC,
it was originally a dos tool, but I'm not 100% sure of that.

At this point, most windows machines will open a .tar.gz (recent
versions of winzip are perfectly happy opening them).

--Rogan

> Galen Seitz (and/or Michael Rasmussen) replied
> to my comment below that tar does not compress files; I thought it
> did. I use the Ubuntu distro and the gzip from the command line to
> compress very large files 5+ MB to an archive type of directory. I
> thought that tar did a similar type of compression but with a
> different file name extension. Can someone provide me with some
> further insight?
>
> Ken
>
> -------------------
> Message: 5
> Date: Thu, 03 May 2007 18:32:32 -0700
> From: Galen Seitz <galens at seitzassoc.com>
> Subject: Re: [PLUG] tar help
> To: "General Linux/UNIX discussion and help;    civil and on-topic"
>         <plug at lists.pdxlinux.org>
> Message-ID: <463A8D30.80904 at seitzassoc.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Michael Rasmussen wrote:
>
> > Kenneth B. Hill wrote:
> >
> >> I don't use tar much to compress files; rather, I prfer gzip. Some MS
> >> Windows PCs don't recognize the .tar extension. I hope this helps.
> >>
> >
> > tar doesn't compress files at all. never has.
> > the -z and -Z options filter the tar contents through compress or gzip
> >
> >
>
> And gnu tar with the -j option will use bzip2.  This is used on the
> kernels at kernel.org(.tar.bz2) and other places.
>
> galen
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list