137

I just realized I can't unrar .rar files on my Ubuntu machine!

What's the easiest way to accomplish this fundamental task? If possible I'd love something like 7Zip that I can just right Click, and extract and have the program worry about how to do it regardless if it's a .zip, a .rar or a .foo compressed file.

4
  • 1
    This should be possible. What happens when you try?
    – ændrük
    May 10, 2011 at 14:37
  • 1
    @Andre: I recieved an error message saying I had to install new software. So I searched and it automatically installed a plugin, now it works fine. May 10, 2011 at 14:52
  • 1
    From the command line, i always 'cheat' and install the 'unp' package - its a command line script that can auto detect and properly extract most common archives, if you have the proper archive programs installed. Just wanted to mention something people often overlook.
    – dr_willis
    May 10, 2011 at 16:23
  • Try PeaZip GUI program. It has portable build without installation. It's Open Source
    – Vlad
    Sep 13, 2020 at 14:23

7 Answers 7

118

Ubuntu by default uses File Roller, which supports the following formats:

7-Zip Compressed File (.7z)
WinAce Compressed File (.ace)
ALZip Compressed File (.alz)
AIX Small Indexed Archive (.ar)
ARJ Compressed Archive (.arj)
Cabinet File (.cab)
UNIX CPIO Archive (.cpio)
Debian Linux Package (.deb) read-only
ISO-9660 CD Disc Image (.iso) read-only
Java Archive (.jar)
Java Enterprise archive (.ear)
Java Web Archive (.war)
LHA Archive (.lzh, .lha)
WinRAR Compressed Archive (.rar)
RAR Archived Comic Book (.cbr)
RPM Linux Package (.rpm) read-only
Stuffit Archives (.bin, .sit)
Tar Archives:
    uncompressed (.tar)
    compressed with:
        gzip (.tar.gz , .tgz)
        bzip (.tar.bz , .tbz)
        bzip2 (.tar.bz2 , .tbz2)
        compress (.tar.Z , .taz)
        lzip (.tar.lz , .tlz)
        lzop (.tar.lzo , .tzo)
        7zip (.tar.7z)
        xz (.tar.xz)
ZIP Archive (.zip)
ZIP Archived Comic Book (.cbz)
ZOO Compressed Archive File (.zoo)
Single files compressed with gzip, bzip, bzip2, compress, lzip, lzop, rzip, xz.

Keep in mind, that this is just graphical front-end, so you still need to install unrar for .rar support;

The unrar package is hosted on the Multiverse repository, so first you'll need to enable the Multiverse repository in Software & Updates;

Then you can install the package either by using Software Centre or by opening Terminal and running sudo apt-get install unrar.

2
  • 3
    I don't understand why this wouldn't "just work" in Ubuntu 18.
    – LondonRob
    Mar 5, 2019 at 11:44
  • 1
    Installing unrar with sudo apt-get install unrar made it possible to extract the .rar file with the pre-installed Archive Manager in Ubuntu 16.04. Thank you for the tip!
    – Ray Walker
    Dec 4, 2020 at 14:55
99

First, run:

sudo apt-get update
sudo apt-get install unrar

You could read man unrar.

From terminal you can use next command:

unrar e -r /home/work/software/myfile.rar

Or, the following command if you want to preserve the directory structure too:

unrar x -r /home/work/software/myfile.rar
2
  • 13
    First you need to run sudo apt-get install unrar to install unrar. Nov 21, 2014 at 2:41
  • If the install fails to find these packages, try apt-cache search unrar. On a raspberry pi, for example the package was named unrar-free so you'd have to install it with sudo apt-get install unrar-free
    – biscuit314
    Sep 13, 2017 at 22:37
21

Install unrar from the Software Center or by running the command

sudo apt install unrar
1
  • 1
    can't be found in software center in ubuntu 18 but the link worked like charm
    – n0krashy
    May 24, 2018 at 22:31
7

If you like then you can also use p7zip-full package. You can install it as:

sudo apt-get install p7zip-full p7zip-rar

The main purpose of this package is to provide 7z and 7za file archivers with high compression ratio.

2
  • For this I get "Package p7zip-rar is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source" Jan 26, 2017 at 19:52
  • @RoyTruelove , apt-cache search p7zip-rar , what is the output ?
    – Raja G
    Jan 27, 2017 at 4:24
5
$ sudo apt-get install unrar
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package unrar is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unrar' has no installation candidate

I tried the above command on Ubuntu 16.04, but it didn't work.

The following command worked fine for me:

sudo apt-get install unrar-free
3

The half-GUI method:

sudo apt update
sudo apt install unrar

Then, in your favorite file manager (ex: nemo, my favorite, or nautilus [Ubuntu's default]), right-click the .rar file and go to Extract Here. Done!

enter image description here

0

Here are some free alternatives to the non-free unrar package:

  1. The libarchive-tools package provides the bsdtar command that can extract many file formats, including RAR files. To install:

    sudo apt-get install libarchive-tools
    

    Extract RAR files using:

    bsdtar -xf myfile.rar
    
  2. The unar package provides the unar command for extracting a variety of file formats, including RAR files. To install:

    sudo apt-get install unar
    

    Extract RAR files using:

    unar myfile.rar
    

Another free alternative is the unrar-free package. However, unrar-free is only able to extract RAR files, unlike bsdtar and unar which are able to extract many file formats. Furthermore, starting in Ubuntu 22.04 (Jammy Jellyfish), unrar-free is just a wrapper around libarchive (just like bsdtar), which makes unrar-free redundant.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .