For system, network and cloud administrators

How to extract .rar archives/files in Linux

All over the web, you might encounter some much needed files are archived using RAR, like your Linux course certification files, for example. That’s when, it’s useful to know how to extract them using the proper software.

Ubuntu / Debian based Linux distributions

If you’re using an Ubuntu or Debian based distribution, you can use the free version of unrar and you can install it using the following command:

sudo apt install -y unrar-free

Create a folder and extract your files inside it using the following command:

unrar -x yourfile.rar /path/to/your/folder/

As you may have noticed, the -x flag is actually telling the program to start the extraction process. And you can also use the:

  • -p flag, if you’re extracting from a password protected .rar archive;
  • -f flag, if you want to force/overwrite the files during the extraction process;
  • -t flag, to just list the files within a .rar archive;
  • -v flag, to check the software’s version.

Red Hat Enterprise Linux (RHEL) based Linux distributions

If you’re using a RHEL based distribution such as, CentOS, for example, you can use the unar package; the thing is, you’ll first have to install the epel-release package and then you’ll be able to install:

sudo yum install -y epel-release
sudo yum install -y unar

But if you’re using, let’s say, Fedora, then you can just use the following command:

sudo dnf install -y unar

Now, in order to extract the .rar archive using the unar package, you can use the following command:

unar yourfile.rar

Leave a Reply

Your email address will not be published. Required fields are marked *