Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '-z flag for tar' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
-z flag for tar
Authored by: miketja on May 16, '02 09:34:23AM

The tar command on OSX includes the option for the '-z' flag, which will (de)compress the tar file on the fly -- no need to use stdin/stdout piped to gzip. For example:

% tar cf - . | gzip > ../filename.tgz

can be shortend to:
% tar zcf - . > ../filename.tgz

Also, the '-' after the 'f' option tells tar to send its output to STDOUT, but this could also be a file, eg.
% tar zcf ../filename.tgz .

Both these options also work in reverse:
% tar zxf ../filename.tgz
will gunzip the file on the fly as well as extracting the files from the tar archive.



[ Reply to This | # ]