Sometimes we face the problem of viewing zipped files. Zipped files are nothing but files that have been compressed using an appropriate utility. Let us understand what the term ZIP means.
ZIP File Format
The ZIP file format is a data compression and archive format. A ZIP file contains one or more files that have been compressed to reduce file size. Compressing the document(s) into a zip file is also sometimes reffered to as deep-packing.
ZIP files generally use the file extensions ".zip" or ".ZIP" and the MIME media type application/zip. ZIP file format is also used as a wrapper for a large number of small items in a specific structure. Zipped files have a file extension different from when they are left uncompressed. ZIP compresses every file separately. Individual files are thus allowed to be retrieved without reading through other data. A large number of small files are generally large in size if they are not compressed. For example, tar.gz archive consists of a TAR archive compressed using gzip. There are various compressing utilities available on an Open Source platform, such as GNU gzip project, Info-ZIP and 7zip.
The files can be unzipped or decompressed, using unzipping programs installed on your Linux system. Let us list some of the zipping and unzipping utilities. You can install these utilities from Applications-> Add/Remove. You can also install them from System-> Administration-> Synaptic Package Manager.
1. unzip: This is a de-archiver for .zip files. It can handle any file produced either by PKZIP, or the corresponding InfoZIP zip program. It also supports encryption.
2. zlib-bin: It is a compression library that contains some useful sample programs from the contrib directory. It includes minizip and miniunzip as zipping and unzipping utilities respectively.
3. zziplib: The zziplib is a lightweight library, that offers the ability to easily extract data from files archived in a single zip file. Files can be compressed into a single zip archive and easily accessed using zziplib applications.
How to unzip a zipped file
When you have a file that has been compressed using a zip utility, you can always obtain the original files by extracting them from the archive file. Double click the archive file to open it. Then you will an option 'Extract' on the menu bar. Just click this option to get the original uncompressed file(s).
There is yet another way to unzip a zipped file. Just open the terminal from Applications-> Accessories-> Terminal. Then type
varsha@varsha-laptop:~$ unzip filename.zip
For .tar.gz and .tar.bz2,
varsha@varsha-laptop:~$ tar -xvf filename.tar.gz
varsha@varsha-laptop:~$ tar -xvf filename.tar.bz2
See the manual for details.
How to create an archive
Right click on the file or folder you want to archive. You will get an option Create Archive. Just click on it. You will get a window where you can save it under any name, and select the type of compression required.
If you prefer it via command line, first cd to the directory, then use the zip command.
varsha@varsha-laptop:~$ zip -r filename.zip files
If there are multiple files type each of them with a space or type *.* to select all the files.
There you are!
You can now extract files from archives, and also create archive files.