How to Open RAR Files in Linux using Unrar

Download Article
A step-by-step guide to extracting RAR files on Ubuntu, Debian, and more
Download Article

If you want to open a RAR file on Linux, it's easy—you'll just need to use the Unrar command. While most Linux distributions, including Ubuntu, don't come with Unrar, you can easily install it using your distro's package manager. Once installed, use the command unrar x <filename> to extract all files and directories from the RAR archive. This How.com.vn article will teach you how to unrar files on Linux using the Unrar command.

Things You Should Know

  • You can usually install Unrar using your Linux distribution's package manager. On Ubuntu, use sudo apt-get install unrar.
  • To unrar files, use the command unrar x filename.rar.
  • To unrar to a specific directory, use unrar x filename.rar /path/to/directory.
Section 1 of 2:

Installing Unrar

Download Article
  1. How.com.vn English: Step 1 Debian & Ubuntu.
    Unrar, which is the Linux command line version of the popular WinRAR app, is easy to download with apt-get.
    • Type sudo apt-get update and press Enter.
    • Type sudo apt-get install unrar and press Enter.
  2. How.com.vn English: Step 2 Redhat, CentOS, & Fedora.
    On Redhat-based Linux distros, you can use dnf to install the Unrar package.
    • Type sudo dnf upgrade and press Enter.
    • Type sudo dnf install unrar and press Enter.
    Advertisement
  3. How.com.vn English: Step 3 Arch Linux.
    You can use pacman to install Unrar:
    • Type pacman -Syu and press Enter.
    • Type pacman -S unrar and press Enter.
  4. How.com.vn English: Step 4 OpenSUSE.
    You can use zypper to install Unrar:
    • Type zypper refresh and press Enter.
    • Type zypper install unrar and press Enter.
  5. How.com.vn English: Step 5 Downloading the binaries.
    Some distributions may not have Unrar in their repositories because the software isn't open source. If you can't find Unrar in your distro's package manager, you can download the source code and install it easily:
    • First, download the latest version of RAR using this command:
      • x64: wget https://www.rarlab.com/rar/rarlinux-x64-621.tar.gz
      • x86: wget https://www.rarlab.com/rar/rarlinux-x32-621.tar.gz
      • You can double-check the latest version at https://www.rarlab.com.
    • Untar and unzip the downloaded file:
      • x64: tar -zxvf rarlinux-x64-621.tar.gz
      • x86: tar -zxvf rarlinux-x32-621.tar.gz
    • Enter the new directory called rar by typing cd rar and pressing Enter.
    • Type sudo make and press Enter. This copies the Rar and Unrar binaries to /usr/local/bin.
  6. Advertisement
Section 2 of 2:

Using Unrar

Download Article
  1. How.com.vn English: Step 1 Use unrar x filename.rar to unrar the file.
    When you use the x option, you'll preserve the directory structure (folders and subfolders) when extracting the files.[1]
    • This command will extract all files and folders from the RAR file to the current directory. If you want to extract the files to a different directory, use unrar x filename.rar /path/to/directory.
    • If the RAR file requires a password, you'll be prompted to enter it. Many RAR files are protected by passwords for security purposes.
  2. How.com.vn English: Step 2 Use unrar e filename.rar to extract files without preserving directories.
    If you want all files from the archive to be extracted to the same location instead of keeping the directory structure in which they were compressed, use this option. In most cases, it's better to use the x option instead.
    • You can specify the directory you want to extract the file to with unrar e as well. E.g., unrar e myfile.rar /usr/local/bin
    • If you have a RAR file that came with multiple parts (e.g., .rar, .rar.00, .rar.01), you'll only need to use the above command on the first file (the one ending in .rar). This will extract the files from the RAR's other parts.
  3. How.com.vn English: Step 3 Use unrar l filename.rar to list files and directories in the archive.
    If you want to see what's inside the RAR file before extracting the files, you can use this command to view the files and structure.
  4. How.com.vn English: Step 4 Use unrar t filename.rar to test the integrity of a file.
    This checks the structure of the RAR archive and displays the results.
  5. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    How do I count files in a Linux directory?
    How.com.vn English: Blain Gunter
    Blain Gunter
    Computer Repair Specialist
    Blain Gunter is a Computer Repair Specialist and small business owner based in Bakersfield, California. He was first introduced to computers at the age of five and has over twenty years of experience in his field. He is both an IT consultant and computer repair technician and takes pride in his ability to troubleshoot anything. He works with hardware, software, Windows, macOS, GNU/Linux, and even vintage electronics.
    How.com.vn English: Blain Gunter
    Computer Repair Specialist
    Expert Answer
    In Linux, you can utilize various commands to count files within a directory. One such command is 'ls,' and another is 'tree.' These commands not only display file information but can also provide a count of files within a directory. Additionally, the 'find' command can be employed for this purpose. For example, the 'find' command with the '-type f' option can list all files in a directory, and using 'wc -l' can count the total number of files.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      • If you are uncomfortable with the command line and are looking for a GUI RAR interface for your Linux installation, you can try out PeaZip. PeaZip works in GNOME and KDE and is available in DEB or RPM packages. You can download it from https://peazip.github.io/peazip-linux.html.
      • RAR3 is the current version of the RAR format. It added the Advanced Encryption Standard with a 128-bit key length. It also supports files larger than 4 Gigabytes and Unicode names.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      How.com.vn English: Blain Gunter
      Written by:
      Computer Repair Specialist
      This article was written by Blain Gunter and by How.com.vn staff writer, Nicole Levine, MFA. Blain Gunter is a Computer Repair Specialist and small business owner based in Bakersfield, California. He was first introduced to computers at the age of five and has over twenty years of experience in his field. He is both an IT consultant and computer repair technician and takes pride in his ability to troubleshoot anything. He works with hardware, software, Windows, macOS, GNU/Linux, and even vintage electronics. This article has been viewed 784,584 times.
      How helpful is this?
      Co-authors: 18
      Updated: September 20, 2023
      Views: 784,584
      Categories: Linux
      Thanks to all authors for creating a page that has been read 784,584 times.

      Reader Success Stories

      • How.com.vn English: Victor Fortmann

        Victor Fortmann

        Jul 19, 2016

        "Method 2 was a great help. I'm pretty new to Linux OS, kind of new the unrar x, but had no idea that other..." more
      Share your story

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement