How to Install Unrar on Debian-Based Linux

This article provides a straightforward guide on how to install the unrar utility on Debian-based Linux distributions, including Debian, Ubuntu, and Linux Mint. It details how to enable the necessary software repositories, install the package via the APT package manager, and execute basic commands to extract RAR archives.

Enable the Appropriate Repository

The standard unrar package is proprietary software, meaning it resides in restricted repositories depending on your specific distribution.

  • On Debian: Open /etc/apt/sources.list using a text editor with root privileges:

    sudo nano /etc/apt/sources.list

    Ensure contrib and non-free are appended to the end of your repository lines (e.g., main contrib non-free). Save and exit the file.

  • On Ubuntu / Linux Mint: Enable the multiverse repository using the command line:

    sudo add-apt-repository multiverse

Update Package Lists

Before installing any new software, refresh your local package index to ensure your system recognizes the newly enabled repository:

sudo apt update

Install Unrar

Install the full, non-free version of unrar by running:

sudo apt install unrar

(Note: There is an open-source alternative named unrar-free, but it lacks support for newer RAR5 archive formats. If you only need basic, open-source support, you can run sudo apt install unrar-free instead.)

Verify the Installation

Check that unrar is installed correctly and verify its version:

unrar --version

Basic Usage

To extract files from a RAR archive into the current directory without preserving directory structures, use:

unrar e archive.rar

To extract files with their original directory paths and hierarchy intact, use:

unrar x archive.rar

To list the contents of an archive without extracting them:

unrar l archive.rar