[PLUG] Syntax to compress a folder with tar

Justin The Cynical cynical at penguinness.org
Tue Sep 24 01:27:08 UTC 2002


On 21 Sep 2002 22:49:50 -0700
Chris Emery <deathfox at moochercrew.org> wrote:

CE> On Sat, 2002-09-21 at 21:19, Stephen Liu wrote:
>> Hi All People,
>> 
>> Kindly advise what is the correct syntax to tar (compress) a fold (directory) 
>> which contains sub-folders (sub-directories) and files.
>> 
>> Thanks in advance.
>> 
>> Stephen Liu

CE> tar czf <file.tar.gz> <file>


I'm going to pick a nit here...

tar doesn't actually compress anything, it's just an archiver (Tape Archiver).  One still has to run the resulting file through a compressor.

The z flag as listed above just automagically filters the archive through gzip/compress (depending on the case of the letter z).  Check the man page for confirmation.  The GNU version of tar I have (1.13) supports z, Z, and y (gzip, compress, and bzip2), just remember that not all versions of tar have support for these flags.

For example, the tar that Sun includes by default in the Solaris 8 environment doesn't.  Guess which program I replaced with the GNU version real quickly?

-- 
"Remember, no matter how cynical you think you are,
  reality is going to find a way to make you look naive."
	-- Shmuel Metz in the SDM
              * Justin The Cynical - cynical at penguinness.org*




More information about the PLUG mailing list