The 7z (7-Zip) archive format offers good compression ratios and is an open source format. This and the favored 7-Zip graphical file archive tool for Windows have popularized the format.

7z archive

A default Ubuntu installation can’t extract or create 7z files. A package is available in the universe repositories that makes working for these files seamless with Ubuntu’s existing archive tools.

Install 7z file archive support from the package p7zip (click the link to install), or by running the command below in your terminal:
sudo apt-get install p7zip

You can now create 7z archives by right-clicking a file or folder and selecting Create Archive, and selecting the 7z option. Open a 7z archive by double clicking it.

Occasionally I’ll get an E_NOTIMPL error compressing a large number of files using Create Archive. This error should be safe to ignore.

p7zip is easy to use on the command line. To compress a file, mystuff to mystuff.7z:
p7zip mystuff

To decompress the archive:
p7zip -d mystuff.7z

compression comparison graph

I did a quick test of some available compression formats in Ubuntu. I archived 97.9 MB of source code in four formats.

The 7z format clearly compressed the source code far better than other formats, but it took significantly longer to do so.

You may also be interested in adding similar support for RAR archives.


Related Posts