ThisCalculator

Everyday

Extract RAR Files on Linux: 6 Easy Ways

Updated · Standard formula, shown below

Extract RAR Files on Linux: 6 Easy Ways

To extract RAR files on Linux, you need a utility that supports the RAR format, since standard Linux archive tools handle zip and tar but not RAR by default. The most common options are the command-line tools unrar and rar, or a graphical archive manager like File Roller (GNOME) or Ark (KDE) once the appropriate backend is installed. This guide covers the exact commands for each method, what to do when you get a “command not found� error, and how to handle password-protected or multi-volume archives.

Why Linux Can’t Extract RAR Files Out of the Box

The RAR format is proprietary, created by Eugene Roshal. The compression and decompression algorithms are not open-source, so most Linux distributions avoid bundling RAR support by default. Instead, they rely on the unrar package, which is a free but not open-source utility distributed under a license that allows free use for personal purposes. Some distributions ship unar (The Unarchiver) as an alternative, which is open-source and handles RAR files without the proprietary RAR code.

Because of this licensing situation, you’ll often find that zip and tar work immediately, but typing unrar gives a “command not found� error. That’s expected—you need to install the appropriate package first.

Installing RAR Extraction Tools

The exact command depends on your Linux distribution. Here are the most common ones:

  • Debian/Ubuntu: sudo apt install unrar (or unrar-free for a lighter, open-source version)
  • Fedora/RHEL/CentOS: sudo dnf install unrar (requires EPEL repository enabled)
  • Arch Linux: sudo pacman -S unrar
  • openSUSE: sudo zypper install unrar

If you prefer a graphical method, installing unrar also enables the built-in archive manager (Files on GNOME, Dolphin on KDE) to extract RAR files by right-clicking. Alternatively, install p7zip-full and p7zip-rar—the latter adds RAR extraction support to 7-Zip, which is often already installed.

Using the unrar Command (Command Line)

The unrar command is the most reliable way to extract RAR files. Basic usage:

  1. Open a terminal in the directory containing the .rar file.
  2. Run unrar x filename.rar to extract with full paths (preserves folder structure).
  3. Use unrar e filename.rar to extract files without paths (all files go into the current directory).

Common options you’ll actually need:

  • -o+ – overwrite existing files without asking.
  • -o- – skip files that already exist.
  • -p – prompt for a password (or use -ppassword to supply it directly).
  • unrar l filename.rar – list the contents without extracting.
  • unrar t filename.rar – test the archive for integrity.

For example, to extract a password-protected archive into a specific folder:

unrar x -psecret /path/to/file.rar /path/to/destination/

Note: the destination folder must already exist, otherwise unrar will fail.

Extracting with 7-Zip (p7zip)

If you already have p7zip installed, you can use 7z to extract RAR files, provided you also install the p7zip-rar plugin. The command is:

7z x filename.rar

This works similarly to unrar but uses 7-Zip’s interface. The advantage is that p7zip is often pre-installed on servers, so you may not need to install anything extra. However, p7zip-rar is not available in all repositories—on Fedora, for example, you might need to install from RPM Fusion.

Graphical Extraction (File Manager)

Most desktop Linux environments include a file manager that can extract RAR files once the backend is installed. Here’s how it works:

  • GNOME Files (Nautilus): Right-click the .rar file and select “Extract Hereâ€� or “Extract to…â€�. The system will use unrar or file-roller.
  • KDE Dolphin: Right-click and choose “Extractâ€� – it uses Ark, which needs the unrar package.
  • XFCE Thunar: May require the thunar-archive-plugin in addition to unrar.

If the “Extract� option is greyed out, it means the RAR backend is missing. Install unrar and restart the file manager (log out and back in) to fix it.

Handling Multi-Volume and Corrupted RAR Archives

Multi-volume RAR files have names like archive.part1.rar, archive.part2.rar, etc. To extract them, you only need to run the command on the first part:

unrar x archive.part1.rar

It will automatically find the subsequent parts. If you get a “CRC failed� error, the archive is corrupted or incomplete. Try downloading the missing part again. You can also use unrar t archive.part1.rar to test all parts before extracting.

For a corrupted archive that still extracts partially, you can try unrar x -kb filename.rar (keep broken files) or unrar x -p- filename.rar to skip password prompts. But note that extracted files may be unusable if the data is damaged.

Creating RAR Files on Linux

To create a RAR archive, you need the rar command, which is not included in the unrar package. Install it with:

  • Debian/Ubuntu: sudo apt install rar
  • Fedora: sudo dnf install rar (from RPM Fusion)
  • Arch: sudo pacman -S rar

Then use:

rar a archive.rar file1 file2 folder/

To create a password-protected archive:

rar a -p archive.rar files/

Note that rar and unrar are separate packages; installing one does not install the other.

Frequently Asked Questions

How do I extract a RAR file without installing anything?

You can’t directly, but you can use an online extraction service or a portable binary like unar (The Unarchiver) that you can download and run without root. However, uploading sensitive files to a web service is a security risk. The safest approach is to install unrar from your distribution’s repository—it’s a small package and a one-time setup.

Why do I get “command not found� for unrar after installing it?

This usually happens because the package is installed but the terminal session hasn’t refreshed its PATH, or you installed unrar-free which may place the binary under a different name like unar. Try logging out and back in, or run which unrar to check the installation path. If you used unrar-free, use unar instead.

Can I extract a RAR file on a headless server?

Yes, the command-line tools work perfectly without a graphical environment. Just SSH into the server, install unrar via your package manager, and run the extraction command. For example, on Ubuntu Server: sudo apt update && sudo apt install unrar, then unrar x file.rar.

What is the difference between unrar and unrar-free?

unrar is the official RARLAB utility, which is free but not open-source. unrar-free is an open-source implementation that supports extracting RAR files but may not handle all newer RAR5 archives or advanced features like recovery records. For most users, unrar is the safer choice.

How do I extract a RAR file with a password on Linux?

Use unrar x -p and it will prompt you for the password. Or supply it directly in the command: unrar x -ppassword file.rar. Be aware that the password will be visible in the terminal history, so it’s better to use the prompt method for sensitive passwords.

Can I extract a RAR file using the tar command?

No, tar does not support the RAR format. You must use unrar, 7z, or a graphical tool. Trying tar -xf file.rar will result in an error because tar expects its own format.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.