Data Compression with ZIP command

ZIP command with examples

 

ZIP command is used to compress a huge file. It will be very useful in the time of data transfer between two systems. If space in the partition seems to be very less means you can use command to compress it.

 

Syntax:

#zipĀ  <options> <destinationfilename.zip> <sourcefilename>

 

To zip a single file
#zip hello.zip hello

 

To zip 4 individual files

#zip abcd.zip a.txt b.txt c.txt d.txt

 

To zip an entire directory

#zip -r testfolder.zip testfolder

 

To assign password for zip file
#zip -e hi.zip hi.txt

 

To compress at Level 9, level 9 is max compressionĀ 

#zip -9 name.zip /var/www/*

 

Zip entire folder with full compression.

#zip -9 -r public_html1.zip public_html1

 

To find out what are the files present in the a zip file
#zipinfo My.zip

 

To encrypt and set password for the zip file
#zipcloak My.zip