7-Zip was hitherto a part only of my Windows tools arsenal; the compression tools available on GNU/Linux were so well integrated into the operating system that one hardly has to think about installing a separate compression tool. But even on Windows I had used 7-Zip to compress only to the gzip or similar popular compression formats and never to the native compression format of 7-Zip. It was only when by mistake I compressed a folder to the 7-Zip format(.7z) that couple of surprises were in store for me.

One is that, 7-Zip is lot more efficient at achieving high compression rates than most of the other popular compression tools(including gzip and bzip2). The difference in the sizes of compressed files was not trivial: .7z files were atleast 25% smaller than the .zip files created using WinZip(popular compression tool for Windows). Go to the home page of 7-Zip for some benchmarks of the different compression tools. As an example, consider the following statistics(from this source):

XAMPP Windows 1.5.4     86 MB     ZIP Archive
XAMPP Windows 1.5.4     28 MB     Selfextracting 7-ZIP archive

XAMPP Lite 1.5.4                    43 MB     ZIP archive
XAMPP Lite 1.5.4                    16 MB     Selfextracting 7-ZIP archive

Even the compression and decompression times are not that high for 7-Zip.

The second surprise was that none of my GNU/Linux systems understood the .7z format ‘out-of-the-box’. Alas, the format of the most popular Free compression tool for Windows is not even recognised by the most popular Free software on the planet. A quick Google-search resulted in the port of the 7-zip package for the GNU/Linux platform – p7zip – hosted on sourceforge.net website. Below are the simple commands that will get it installed on Gentoo, Ubuntu and Debian systems. RPMs should be available for Fedora, SUSE, Mandriva etc distributions also or I think one can install it through their respective packaging systems too.

Installing p7zip:

7zip on Gentoo:

sh# emerge p7zip

7zip on Debian/Ubuntu:

sh# apt-get install p7zip

(Don’t forget to add ‘sudo’ in front of the command on Ubuntu systems).

How to use p7zip on GNU/Linux:

To create an archive of all the files present in a directory:

sh# 7za a -t7z test.7z *

To extract the contents of an archive:

sh# 7za e test.7z

Use ‘-t’ switch to specify the compression format to be used(zip, 7z etc). For more help on number of available command line switches, type:

sh# 7za –help

The software can be built from the sources too; download the source code from here.

More information about p7zip is available on the Sourceforge website. RPMs for Fedora and Mandriva distributions are provided on the same page.