.tar and .tar.gz

a question that maybe has nothing to do with AIX, but on AIX it causes me to do two commands, while i can do it on linux in one command.

why are files always compressed in .tar.gz ???
i don't see the benefit over just compressing it to .tar

on linux i can decompress .tar.gz files with tar -zxvf file.tar.gz

on Aix i have to to first gunzip file.tar.gz, and thereafter tar -xvf file.tar. is there a way to do it in one command on aix???

.tar is not compressed at all, it is just an archive format.

Linux (GNU tar) has non-standard extensions added to tar that other implmentations of tar do not have. If the extra typing is a problem write a short shell script to do it.

Exactly. A tar file is like a "package" but not compressed at all.
A .tar.gz (or .tgz in some cases) is just a gzip compressed tar file.

In this case, that extension is the "z" flag. Have a look to gtar man pages.

For instance, in one line:
gzip -c myfile.tar.gz | tar xvf -
or
tar cvf - whatever | gzip -c > myfile.tar.gz
Regards.

I would like to add that archiving and compressing are two distinct independent tasks. It is not very "UNIX-like" to combine distinct tasks into one tool, so GNU-tar, as handy as it may be, is a little bit against the cultural tradition of UNIX.

bakunin

I agreed GNU-tar is "against the cultural tradition of UNIX" but assume if we need to ftp many directory from one server into another every hours ??
1: maintain the dir
2: reduce the size so that FTP faster
By using GNU-tar it save us a lot of time,i believe.
In my environment we need to sync data between server in different country, this work the best.

In that case, you may consider using "rsync" :slight_smile:

I guess this is why the shell was invented in first place: to glue together all the little specialized tools which do only what they are intended to do, but that they do efficiently.

For the same reason one might need a tool that lists a directory and to translate its contents into chinese - that doesn't mean it would be a good idea to incorporate a translator for chinese into "ls".

If you buy tools (out in the real world, not on a computer) you'd usually buy screwdrivers, hammers, saws, etc.. These tools may serve only one purpose (a screwdriver for handling screws, a hammer for hammering, etc.), but ideally they serve this purpose well. If you try to buy a screwdriver which is a saw and a scissor and a hammer at the same time you'll end up with some sort-of "72-functions-swiss-army-knife", which does serve a lot of purposes all equally bad.

bakunin