For demonstration purposes, we’re using Ubuntu 22.04 LTS.

Installing them is pretty straightforward.

Simply follow your specific Linux distribution’s installation command(s).

A Linux Terminal with the manual for

Hannah Stryker / How-To Geek

For testing purposes, we’re creating some text files and adding a line to them.

If you already have the files you want to archive, then you don’t need to do this.

Then you specify the name of the RAR file you want to create.

The Linux terminal displaying the installation of the rar and unrar commands on Linux

Lastly, list all the files and directories you want to add to the archive.

How to Extract RAR Files on Linux

The rar command lets you create an archive.

To extract an existing RAR file, you use the unrar command.

The Linux terminal showing the creation of a RAR file using several text files on Linux

The syntax is pretty simple.

Let’s use unrar to extract files from the archive we created earlier.

Then, you input the RAR file name.

The Linux display showcasing how to extract files from a RAR archive on Linux

Otherwise, the command won’t work.

Extract RAR Files and List the Directory Structure

Suppose you have several directories in your archive.

If you extract it using the normal method, you might only see the files that were extracted.

The Linux terminal showing the process of extracting a RAR archive to a specific directory on Linux

However, the “x” option from the unrar command lets you see the directory structure as well.

That is, you’re able to see which file is inside which directory in the archive.

Let’s see that in action.

The Linux terminal displaying the process of extracting files from a RAR archive with the directory structure on Linux

That’s where listing the files can help you.

If a file looks good, the command displays an “OK” status for that.

The “u” option of the rar command is for that purpose.

The Linux terminal displaying the contents of a RAR archive file without extracting it on Linux

It updates your archive and lets you add new files.

But how do you repair or delete them?

For repairing or deleting, you have the “r” and “d” options, respectively.

The Linux terminal showing the integrity of all the files of a RAR archive on Linux

To repair a RAR file, run:

The above command first creates a “fixed.test.rar” file.

Deleting files is simple.

Simply specify the name of the files you want to delete from the archive.

The Linux terminal displaying the process of adding a new file to a RAR file on Linux

In our case, we want to delete “test6.txt” from the “test.rar” file.

you’ve got the option to also specify the size of each part.

Say, we want to split an archive into several 1MB archives.

The Linux terminal showing the process of fixing a RAR file on Linux

For that, we run:

The “a” option adds new files to the archive.

We specify the size of each archive with the “-v” option.

The naming of the RAR file is important here.

The Linux terminal displaying the deletion of a single file from a RAR archive on Linux

Finally, add the file and directory names you’d like to include in the archive.

And that covers most operations you might do on RAR files on Linux.

The Linux terminal showing how to add a password on a RAR archive on Linux

The Linux terminal displaying how to lock a RAR archive on Linux