Showing posts with label compress. Show all posts
Showing posts with label compress. Show all posts

Friday, July 3, 2009

Archive and Compress Files Using zip

Zip and unzip are two free command line programs that comes with Linux. For Windows, they can be downloaded from the Info-ZIP Website. This article provides the basic of archiving and compressing files using the command line zip program.

Zip one file

zip filename.zip file_to_compress

Zip multiple files

zip filename.zip file_to_compress1 file_to_compress2 file_to_compress3

Compression options


The compression level ranges from 0 to 9. Level 0 means no compression, 1 compress faster, and 9 compress better. The default is 6.
zip -9 filename.zip file_to_compress

Password protect zip archive

zip -P the_password filename.zip file_to_compress

To be prompted for password instead of specifying the password in the command line, use -e instead of -P.
zip -e filename.zip file_to_compress
Enter password:
Verify password:

Unzip files

unzip filename.zip

Unzip files with informations (verbose mode)

unzip -v filename.zip

List files that will be unzipped

unzip -l filename.zip

Test Files That Will Be Unzipped

unzip -t filename.zip