1833247 Members
2809 Online
110051 Solutions
New Discussion

ZIPPING in HP-UX

 
SOLVED
Go to solution
panchpan
Regular Advisor

ZIPPING in HP-UX

Hello.
I have some 1000 files in a dir say /home/pp/ and i wish to zip all of them into one file at another location say /home/pp/tmp/
Could you please let me know the command to zip on HP-UX and then unzip for using them.

Thanks a lot.
12 REPLIES 12
Arunvijai_4
Honored Contributor

Re: ZIPPING in HP-UX

Hi,

You can use # /opt/java1.4/bin/jar -cvf /home/pp/tmp/files.zip /home/pp/*

For unzipping, you can use

# /opt/java1.4/bin/jar -xvf

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
H.Merijn Brand (procura
Honored Contributor

Re: ZIPPING in HP-UX

Depending on the type of file, selecting the correct zipping algorithm might have a big impact.

In most cases bzip2 works best

src # cd /home/pp
src # tar cf - . | bzip2 >/tmp/pp.tbz
src # scp /tmp/pp.tbz dst:/tmp/

dst # cd /home/pp
dst # bzip2 -d
If it is all stripped binaries, jpegs, or other files that do not compress very well, or if bzip2 is not available, use gzip

src # cd /home/pp
src # tar cf - . | gzip >/tmp/pp.tbz
src # scp /tmp/pp.tbz dst:/tmp/

dst # cd /home/pp
dst # gzip
Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
RAC_1
Honored Contributor

Re: ZIPPING in HP-UX

Do you have zip and gunzip, unzip installed? Else, you can just tar them into one tar ball and compress that tar ball.

tar -cvf some_name.tar /path_to_files/
compress some_name.tar
There is no substitute to HARDWORK
Mustafa Gulercan
Respected Contributor

Re: ZIPPING in HP-UX

hi;
You can use gzip which comes with HP-UX by default, Location : /usr/contrib/bin/gzip

Uncompressing, You can use gunzip or gzip -d
Location : /usr/contrib/bin/gunzip

Mustafa Gulercan
Respected Contributor

Re: ZIPPING in HP-UX

if you exactly wanna use zip and unzip first you must install both.

http://hpux.cs.utah.edu/hppd/hpux/Misc/zip-2.31/

http://hpux.cs.utah.edu/hppd/hpux/Misc/unzip-5.52/
Arunvijai_4
Honored Contributor

Re: ZIPPING in HP-UX

Hi again,

If you have Java SDK installed, you will have "jar" utility by default. No need to install any other softwares for zipping/unzipping.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
panchpan
Regular Advisor

Re: ZIPPING in HP-UX

I liked
tar -cvf some_name.tar /path_to_files/
compress some_name.tar

But, how to untar and uncompress some_name.tar ?
H.Merijn Brand (procura
Honored Contributor

Re: ZIPPING in HP-UX

# tar -cvf some_name.tar /path_to_files/
# compress some_name.tar

1. That will use twice the amout of diskspace you would have needed if you would have used my piping solution
2. compress is an ANCIENT (and bad) compression algorithm. It eats more CPU than it compresses your data
3. gzip is standard, why not use it?

compress's counterpart is uncompress

# uncompress some_name.tar
# tar xvf some_name.tar

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Timothy P. Jackson
Valued Contributor

Re: ZIPPING in HP-UX

Hi Panchalp,

I use gzip and it works very well. I transfer large files over ftp and have never had a problem.

If you decide to use gzip, you may want to down load the latest release. HP-UX 11i doesn't have the latest and so it has a problem handling large files. I can't remember it is 200M or 2Gig, but with later releases there is no problem.

Tim
panchpan
Regular Advisor

Re: ZIPPING in HP-UX

Hello.
I also appreciate gzip, but the problem is that - source dir IF i give gzip all the file names will get zipped and renamed to .gz. So I guess first i need to copy all 1000+ files to some tmp dir, gzip them there and then do ftp.

Thank you.
H.Merijn Brand (procura
Honored Contributor

Re: ZIPPING in HP-UX

No, they are not. The tar file is zipped, not the files in turn

# cd /home/dir
# tar cvf - . | gzip > /tmp/home_dir.tgz

tar collects the files into a single tar archive, but -f - causes tar to not use a file, but send the archive stream to STDOUT. That stream in turn is compressed by gzip and stored in a file.
Not only has that a speed advantage, but since you now use gzip on a stream, you won't hit gzip's 2 Gb limit that some older versions have.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
f. halili
Trusted Contributor
Solution

Re: ZIPPING in HP-UX

# cd /home/pp
# tar -cvf temp.tar tmp
# /usr/contrb/bin/gzip temp.tar
# /usr/contrib/bin/gzip temp.tar

This creates temp.tar.gz
You can then copy to any directory you want.

To uncompress:
# cd /directory_you_want
# /usr/contrib/bin/gunzip temp.tar.gz
# tar -xvf temp.tar
# ll tmp

CHEERS,
f.halili
derekh