If you have an Ubuntu/Debian server installation and need to open or create Zip file then you need to install the necessary packages to work with Zip files. Fortunately, we can easily add support for Zip to our installation by installing two packages(Zip, Unzip) both available from the repositories. Note: This post assumes you have the ability to install packages, root or sudo access.
Install Zip from the repositories.
# apt-get install zip
The entire process is quite simple to understand.
# zip -r new-file-name.zip directory-to-compress/
It is possible to add more than one directory in to the same archive.
# zip -r new-file-name.zip directory-1/ directory-2/
But, what if I only need to compress a single file. Similar process except we don’t need to use the -r(recurse) option.
# zip report.zip LitenDuplicateReport.csv
Opening or extracting the contents from a compressed archive is handled not by the Zip package but by a second package called Unzip.
# apt-get install unzip
With Unzip you have two options as to how the contents will be extracted, either you can extract the contents of the compressed archive to a directory or simply extract the contents to the current directory.
# unzip nc111nt.zip -d netcat/
Or you can extract the contents of the archive to the current directory you are in.
# unzip nc111nt.zip
All you need is two packages and your installation will be able to work with Zip archives. I know Ubuntu/Debian have support for Gzip but if you work with Windows users and need to share files with them then Zip might be the only way to go.
compression, linux, ubuntu, zip — Aug 9, 2012