How to unrar in Ubuntu

Files with a .rar extension are compressed archives, much like a .tar.gz or .zip file. It’s one of many file compression formats that rose to popularity over the years, but requires its own utility to use.

You may have an individual .rar archive such as file.rar, but RAR archives are also known for being split into multiple files, such as file.rar, file.r00, file.r01, etc. In these cases, it’s necessary to open the file.rar file, which will then automatically combine the rest of the files into a single archive and extract its contents.

In this guide, we’ll see how to extract files from a RAR archive on Ubuntu Linux. This will work whether you have an individual .rar file or an archive that’s been split into a sequence of files.

In this tutorial you will learn:

  • How to install unrar utility
  • How to use unrar utility to open rar files

Unrar on Ubuntu

Unrar on Ubuntu

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu Linux
Software unrar
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Unrar Utility

Ubuntu isn’t able to open .rar files by default. In order to unrar, you’ll need to install a small utility. Open a command line terminal and type the following commands to install it:

$ sudo apt update
$ sudo apt install unrar


Open rar files

Now that the unrar utility is installed, you can use the following command syntax to extract files from a RAR archive into your current working directory.

$ unrar x files.rar

You can also specify a different directory after the archive name if you wish to extract the files somewhere else.

$ unrar x files.rar /path/to/dir

If you’d like to see the contents of the RAR archive, without extracting any files, use the l option.

$ unrar l files.rar
Listing files from a RAR archive

Listing files from a RAR archive

Now that you know the file names inside the archive, you can extract them individually if you’d like. For example, this command would extract one text file from our example RAR archive.

$ unrar x files.rar file1.txt
Extracting a particular file from RAR archive

Extracting a particular file from RAR archive

Specify multiple files to extract, if you’d like.

$ unrar x files.rar file1.txt file2.txt

That’s all there is to it. You may also be interested in our guide about creating compressed archives using RAR.

Closing Thoughts

In this guide, we saw how to extract files from a RAR archive on Ubuntu Linux. The process is very simple once you install the unrar utility and know the correct switches to use with the command.