PDF download Download Article
A step-by-step guide to extracting RAR files on Ubuntu, Debian, and more
PDF download 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 wikiHow 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

PDF download Download Article
  1. 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. 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. You can use pacman to install Unrar:
    • Type pacman -Syu and press Enter .
    • Type pacman -S unrar and press Enter .
  4. You can use zypper to install Unrar:
    • Type zypper refresh and press Enter .
    • Type zypper install unrar and press Enter .
  5. 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

PDF download Download Article
  1. 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. 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. 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. 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?
    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.
    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
      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
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      Thanks to all authors for creating a page that has been read 804,306 times.

      Reader Success Stories

      • 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?

      Advertisement