Rar and unrar

Rar ist a proprietary archiving algorithm, being published as shareware. The Debian package of Rar supplied by Ubuntu is also subject to such a license, according to which the packing program may be tested for 40 days before it must then be deleted, unless a single or multi-user license is purchased..

For unpacking rar archives, unrar is a proprietary but free program. After installation, unrar is also used by the graphical archive front-ends (File Roller etc.) to extract files, so that it is sufficient to click on a .rar file in the file manager on the desktop to unpack its contents. On the Gnome desktop, for example, you can right-click to select either “Extract” or “Extract to”.

In the terminal there are more options:

unrar e /path/to/archive.rar
unrar x /path/to/archive.rar
unrar -kb x /path/to/archive.part001.rar

The first example uses the command “e” to extract files in a “flat” ignoring paths in the archive, if any. The command “x” however restores paths as well.

Large archives often consist of several files, recognizable by the consecutive numbering. Such archives are opened by using unrar with the first partial file’s name as seen in example 3. The following files are then unpacked automatically by unrar. If a partial file is missing, unrar aborts the unpacking process. If the “-kb” (keep broken) switch is used, unrar will not delete the part already unpacked.

Installation

If you only want to unpack rar files, install unrar:

sudo apt install unrar

In order to pack files, install the rar shareware:

sudo apt install rar

Alternativen

gzip and bzip2 are tools that every Linux distributionen has to offer; bzip2 has a better coompression, gzip is faster. The zip format, popular on Windows, is in the public domain and can be used without problems in Lnux, but it is not very capable. The more modern 7z yields better results, well known in the Windows world thanks to the 7-Zip program, in Linux P7ZIP.