Operating System - HP-UX
1832871 Members
3776 Online
110048 Solutions
New Discussion

Compress/zip a file in HP-UX and then uncompress/unzip the same file

 
SOLVED
Go to solution
Deepu Chakravarty
Regular Advisor

Compress/zip a file in HP-UX and then uncompress/unzip the same file

Pls suggest how to compress or zip a file in HP-UX(11.11). Similarly uncompress/unzip the same file.
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Lets say the file is called myfile

to zip:
gzip myfile

it becomes myfile.gz

to unzip

or

compress myfile

it becomes myfile.Z

uncompress myfile.Z

it becomes myfile

SEP
gunzip myfile.gz
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Deepu Chakravarty
Regular Advisor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Thanks for updates.
New info:
I need to compress a group of files. Like file-1 to file-10 in one file. How to compress these files in one compressed file ?
Steven E. Protter
Exalted Contributor
Solution

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

tar cvf archive.tar /directory/*

All files are put in an archive

gzip archive.tar

becomes archive.tar.gz

gunzip archive.tar.gz

becomes archive.tar

tar xvf archive.tar

files untarred from the tarball.

Hope this has been helpful.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Victor Fridyev
Honored Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Hi,

You can run the following:

tar cvf - filename1 filename2 dir1 | gzip > arcname.gz

In order to uncompress:

cd somedir; gunzip -c arcname.gz| tar xvf -


The minus sign ( - ) means standard output and standard input
Entities are not to be multiplied beyond necessity - RTFM
Steven E. Protter
Exalted Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Suggestion for Victor:

Try it or start your own thread.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Victor Fridyev
Honored Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Dear Deepu and Steven
I prefer not to open an additional thread. Please read below, this is a screen copy:
argus:/tmp# ls srvmail.*
srvmail.sh040407.log srvmail.sh040607.log srvmail.sh040807.log
srvmail.sh040507.log srvmail.sh040707.log srvmail.sh041107.log
argus:/tmp# tar cf - srvmail* | gzip > sep.gz
argus:/tmp# mkdir zxc
argus:/tmp# cd zxc
argus:/tmp/zxc# gunzip -c /tmp/sep.gz |tar xf -
argus:/tmp/zxc# ls
srvmail.sh040407.log srvmail.sh040607.log srvmail.sh040807.log
srvmail.sh040507.log srvmail.sh040707.log srvmail.sh041107.log
Entities are not to be multiplied beyond necessity - RTFM
SS_6
Valued Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

You can use compress, gzip commands
#compress abc (To Compress)
#compress -d abc (To decompress)
OR
#uncompress abc
#gzip abc (To Compress)
#gzip -d abc (To decompress)
Use -v option to see compress ratio.
#compress -v abc
You can do man compress or man gzip for more options
By providing solutions I am helping myself
Francisco J. Soler
Honored Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Hi Deepu,
you can download and install zip and unzip utilities similar to MS-DOS, to zip and unzip files MS-DOS compatibles.

http://hpux.cs.utah.edu/hppd/hpux/Misc/zip-2.3/
http://hpux.cs.utah.edu/hppd/hpux/Misc/unzip-5.50/

Frank.
Linux?. Yes, of course.
Deepu Chakravarty
Regular Advisor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Thanks to all who participated.

--DC
KapilRaj
Honored Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Could you once go through the following link please ....

http://forums1.itrc.hp.com/service/forums/helptips.do?#28?

Regds,

Kaps
Nothing is impossible
Sanjay Kumar Suri
Honored Contributor

Re: Compress/zip a file in HP-UX and then uncompress/unzip the same file

Grateful if you allocate points to all those who participated in sorting your posts. 0 to me.
sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.