How to Use RAR files in Ubuntu Linux [Quick Tip]

Looking for WinRAR in Linux? Here’s how to extract and use RAR files in Linux.

RAR is a quite good archive file format. But, it isn’t the best when you’ve got 7-zip in Linux offering great compression ratios and Zip files being easily supported across multiple platforms by default.

It is one of the most popular archive formats, but, Ubuntu‘s archive manager does not support extracting RAR files nor does it let you create RAR files. It would rather show you this error:

There is no command installed for RAR archive files. Do you want to search for a command to open this file?

Ubuntu RAR File Error

Fret not, we have a solution for you. To enable the support to extract RAR files, you need to install UNRAR – which is a freeware by RARLAB. And, to create and manage RAR files, you need to install RAR.

Extracting RAR Files in Linux

Unless you have it installed, extracting RAR files will show you an error “Extraction not performed“. Here’s how it should look like (Ubuntu 18.04):

Error in RAR extraction in Ubuntu

If you want to resolve the error and easily be able to extract RAR files, follow the instructions below to install unrar.

Step 1: Install unrar package from multiverse repository

Launch the terminal and type in the following command to make sure you have multiverse repository enabled in Ubuntu:

sudo add-apt-repository multiverse

Update the package cache:

sudo apt update

Now install unrar package:

sudo apt-get install unrar

Step 2: Extract RAR files either graphically or via command line

After installing unrar, you may choose to type in “unrar” (without the inverted commas) to know more about its usage and how to use RAR files with the help of it.

The most common usage would obviously be extracting the RAR file you have. So, you can either perform a right-click on the file and proceed to extract it from there or you can do it via the terminal with the help of thisĀ  command:

unrar x FileName.rar

You can see that in action here:

Using unrar in Ubuntu

If the file isn’t present in the Home directory, then you have to navigate to the target folder by using the cd command in Linux. For instance, if you have the archive in the Music directory, simply type in “cd Music” to navigate to the location and then extract the RAR file.

Creating & Managing RAR files in Linux

UNRAR does not let you create RAR files. So, you need to install the RAR command-line tool to be able to create RAR archives.

To do that, you need to type in the following command:

sudo apt-get install rar

Here, we will help you create a RAR file. In order to do that, follow the command syntax below:

rar a ArchiveName File_1 File_2 Dir_1 Dir_2

When you type a command in this format, it will add every item inside the directory to the archive. In either case, if you want specific files, just mention the exact name/path.

By default, the RAR files reside in HOME directory.

Using rar archive in Ubuntu Linux

In the same way, you can update/manage the RAR files. Just type in a command using the following syntax:

rar u ArchiveName Filename

To get the list of commands for the RAR tool, just type “rar” in the terminal.

Wrapping Up

Now that you’ve known how to use RAR files on Ubuntu, will you prefer using it over 7-zip, Zip, or Tar.xz?

Let us know your thoughts in the comments below.

Similar Posts

  • # I’ve made this simple python3 script to extract a file from a .rar file
    # and put the data into a folder with the same name of the file in the curent directory.

    # The script is very simple, it’s just a quick help if you are interested.

    # It has some limitations:
    # 1) I renamed the .rar file to be able to execute the program
    # 2) It only extract one .rar file at the time

    # Requisites:
    # * you need to install the unrar program
    # JUST RUN: sudo apt install unrar -y

    # To run the code, just type:

    # python3
    # Example: python3 file_to_extract.rar

    import os
    import sys

    # rename rar file to remove spaces from the name
    raw_argv = sys.argv[1]
    argv_ws = raw_argv.replace(” “,”_”)

    #remove the .rar extension from the file
    #it will be used to create a new folder
    arg = (argv_ws.split(“.”)[0]).replace(” “,”_”)

    #create the new folder
    current_directory = os.getcwd()
    final_directory = os.path.join(current_directory, arg)
    if not os.path.exists(final_directory):

    #path to the new flder
    path = current_directory +”/”+ arg

    #enter the new folder
    os.system(“cd ” + path)

    # command line to extract the file
    terminal_line = “unrar e ” + str(argv_ws) + ” ” + path

    print(“Executed terminal Line is : ” + terminal_line)

  • Thank you, I navigated to the directory my rar file was located in using cd command, and then put in “unrar myfile.rar” and be given a list of commands, one of which was “x” – extract files with full path”. So, I put in “unrar myfile.rar x” and watch nothing happen.
    Great waste of time indeed.