Compressing with GZip and Zip in CentOS

Gzip
Type the following command to compress a file at a shell prompt
gzip filename.ext -> The file will be compressed and saved as filename.ext.gz

Type the following command to expand a compressed file
gunzip filename.ext.gz -> The filename.ext.gz is deleted and replaced with filename.ext

Type the following command to compress multiple files at a shell prompt
gzip filename.gz file1 file2 file3 -> will compress file1, file2, file3 and put them in filename.gzip.

Zip
Type the following command to compress a file at a shell prompt
zip -r filename.zip files -> filename represents the file you are creating and files represents the files you want to put in the new file

Type the following command to expand a compressed file
unzip filename.zip

Type the following command to compress multiple files at a shell prompt
zip filename.zip file1 file2 file3 -> will compress file1, file2, file3 and put them in filename.zip

If you add directory to multiple files
zip filename.zip file1 file2 file3 /user/work/school -> will compress file1, file2, file3, the contents of the /user/work/school directory and put them in filename.zip

One Comment to “Compressing with GZip and Zip in CentOS”

  1. [...] http://twoseven.co.nz/?p=109 – bookmarked by 6 members originally found by plowna on 2008-08-30 Compressing with GZip and Zip in CentOS http://www.nineteenlabs.com/2008/05/15/compressing-with-gzip-and-zip-in-centos/ – bookmarked by 1 [...]


Leave a Reply