1847248 Members
2657 Online
110263 Solutions
New Discussion

to tar and zip few files

 
SOLVED
Go to solution
Fauziah Mahdan
Super Advisor

to tar and zip few files

Hi all
Need to know the exact command to tar few files into single file then to zip it.
Thanks
Fauziah Mahdan
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: to tar and zip few files

# cd /somedir
# tar -cvf filename.tar file1 file2 file3 file4

To zip, you must have already installed zip on your HP-UX machine as zip is not included.

If you have zip installed, do a 'zip -?' for the syntax as I can't recall exactly the syntax required.

You can always use compress or gzip instead.

# compress filename.tar
will create filename.tar.Z
or

# gzip filename.tar
will create filename.tar.gz
Fauziah Mahdan
Super Advisor

Re: to tar and zip few files

thanks patrick
where can id download zip file for hpux 11.23 itanium rx2620 server?
Patrick Wallek
Honored Contributor
Solution

Re: to tar and zip few files

Zip is available here:
http://hpux.connect.org.uk/hppd/hpux/Misc/zip-2.31/

Unzip is available here (yes they are separate packages):
http://hpux.connect.org.uk/hppd/hpux/Misc/unzip-5.52/
Fauziah Mahdan
Super Advisor

Re: to tar and zip few files

ok another question what about if Iw ant to gzip the file by stated the file path.
e.g
/tmp/path/a.tar
Sandman!
Honored Contributor

Re: to tar and zip few files

# gzip /tmp/path/a.tar
OR
# cd /tmp/path && gzip a.tar
Victor Fridyev
Honored Contributor

Re: to tar and zip few files

Hi,

After zip installation run:

Tar cf - file1 file2 | gzip > arc.tar.gz

You don't have to create temporary file.

In order to restore files:

gunzip -c arc.tar.gz | tar xf - [file1 file2 ]

HTH

Entities are not to be multiplied beyond necessity - RTFM