Operating System - HP-UX
1827811 Members
1872 Online
109969 Solutions
New Discussion

How to create a Tar file as zipped from ab initio?

 

How to create a Tar file as zipped from ab initio?

I am interested to know how to create a zipped Tar file from the beggining of the archival process. (Not zipping it after creating the TAR file).
Is this available for Archival files creation with both '-cvf' and '-uvf' options.
This detail would be very helpful.

Thanks
Knowledge grows with Sharing
7 REPLIES 7
Robert T. Stutes
Occasional Advisor

Re: How to create a Tar file as zipped from ab initio?

ON an HPUX box, you can gzip the tar file on the fly using the following command line:

tar cvf - somedir|gzip > somedir.tar.gz

This will create your tar archive as a zipped file without having to create the archive first.
Robert T. Stutes
Occasional Advisor

Re: How to create a Tar file as zipped from ab initio?

ON an HPUX box, you can gzip the tar file on the fly using the following command line:

tar cvf - somedir|gzip > somedir.tar.gz

This will create your tar archive as a zipped file without having to create the archive first.

Naturally, the tar "v" switch is optional. On HPUX 11 gzip and gunzip can be found in the /usr/contrib/bin directory
Robert T. Stutes
Occasional Advisor

Re: How to create a Tar file as zipped from ab initio?

the following command line will do the trick
"tar cvf - somedir|gzip > somedir.tar.gz"
Note that will only work for a "cvf" since tar cannot process and gzipped file.
Robert T. Stutes
Occasional Advisor

Re: How to create a Tar file as zipped from ab initio?

Sorry about the repeated replies. The web site kept telling the reply transfer failed.
Rumen Ginev
Frequent Advisor

Re: How to create a Tar file as zipped from ab initio?

Try with GNU Tar available as 10.20, 11.00 depot from :

http://hpux.asknet.de/hppd/hpux/Gnu/tar-1.13.16/

The option you need is -z or -Z:

#tar -czvf archive.tar.gz files_to_archive

This option is not available in the standard HP-UX tar.
Alan Riggs
Honored Contributor

Re: How to create a Tar file as zipped from ab initio?

To untar a zipped archive in standard HP-UX use:

gunzip -c archive.tar.gz | tar xvf -

Re: How to create a Tar file as zipped from ab initio?

It works. Thanks a lot for your response guys.
Knowledge grows with Sharing