How to Use RAR files in Ubuntu Linux?

The RAR (Roshal ARchive) file is a form of WinRAR archive that consists of one or more compressed files. The RAR files are compressed to reduce the large size of the files for easy sharing. The RAR utility package comes by default in Windows, while in Ubuntu, a third-party application is required. We can make a RAR file in Ubuntu using the RAR package and need an UNRAR package to extract a RAR file.

This write-up will demonstrate the uses of the RAR files in Ubuntu Linux. The content is as follows:

Let’s get started:

How to Use RAR Files in Ubuntu?

This guide will discuss how to use RAR files in Linux. First, we will create the RAR file with multiple and entire folder files. Then, we will perform the steps to extract/unrar a RAR file in Ubuntu.

Let’s start!

How to Create a RAR File in Ubuntu Linux?

If you don’t know how to create a RAR file in Ubuntu Linux? In this section, we will create a RAR file using two methods:

  • Create a RAR file with Multiple Files
  • Create a RAR file with Entire Folder Files

Prerequisites: Install RAR Package

Before creating a RAR file in Ubuntu, we must install the “RAR” package. To install the RAR command line tool, use the following command:

$ sudo apt install rar

Let’s head over to the methods now.

Method 1: Compress Multiple Files Using RAR Utility

This method comprises various steps to create a RAR file from multiple files.

Step 1: Create RAR File Using Multiple Files

Now, we can create a RAR file using the RAR command package. For creating a RAR file in Ubuntu, the general syntax is written below:

$ rar u <folder-name> <files-name>

Following the syntax, the command stated below will compress three files named “file1.txt”, “file2.txt”, and “file3.txt” into a folder named “FilesFolder”:

$ rar u FilesFolder file1.txt file2.txt file3.txt

Step 2: Verify the RAR File

After executing the command, let’s verify the RAR file. The below output shows that all three files are added to “FilesFolder”.

Note: If you have not created the RAR folder but adding files to that folder. The error will not occur, and the new folder will be created automatically.

Method 2: Compress Entire Folder Using RAR Utility

If you want to create a RAR file with all the files in the folder, it is recommended to get the information of the files/sub-directories of that folder. The following steps will guide you to compress the entire folder using RAR:

Step 1: Check the Current Folder

To check the current working folder, use the following command:

$ pwd

Step 2: Check All Files in the Folder

Check all the files (including the hidden files) in the current folder to create a RAR file. To do so, use the below command:

$ ls -a

All files in the current are listed in the above picture.

Step 3: Create a RAR File of Entire Folder

In this step, we will create a RAR file named “NewFilesFolder” with all the files of a folder. To create it, use the below-written command:

$ rar a NewFilesFolder

The error-free output shows it has created a RAR file.

Step 4: Verify the RAR file

To check the new RAR file, use the below-mentioned command:

$ ls

The output shows the successful creation of the RAR file.

How to UnRAR/Extract a RAR File in Linux?

This section will guide you through the steps to extract RAR files or unrar files in Linux. To extract a RAR file, follow the below steps:

Step 1: Install UNRAR Package

To extract/unrar file, we require the UNRAR package. Install the “UNRAR” package utilizing the below-mentioned command:

$ sudo apt install unrar

The error-free output shows the successful installation of the “UNRAR” package. Now, let’s proceed to the next step.

Step 2: Check the RAR file

To check a RAR file, use the “ls” command to list the files in a directory:

$ ls

Step 3: UNRAR a File

Now, to unrar a file, we will run the below command:

$ unrar x FillesFolder.rar

The output shows the extraction of files inside the RAR file.

Step 4: Verify the Extraction of Files

To verify the extraction/unrar of files from a RAR file, use the below command:

$ ls

The output shows successful extraction/unrar of a “RAR” file.

That’s the end of this guide.


RAR files in Ubuntu Linux can be used to create a compressed collection of files to transfer or store files securely. To create a RAR file, install the “RAR” package using the “sudo apt install rar” command, then create a RAR file executing the “rar u <folder-name> <files-name>” command. Moreover, to unrar/extract a file, install the unrar command line tool using the “sudo apt install unrar” command and use the “unrar x <File-name.rar>” command.