unrar and rar Commands

unrar Terminal Application - Extracting RAR Files

unrar is a command line application for extracting compressed Roshal Archive (.rar) files on *nix-based operating systems. 7-Zip, PeaZip, and GNOME Archive Manager are good graphical applications for managing compressed files on desktop systems. But depending on your workflow, you may need a solution available on your Linux VPS. Note that the terminal application is oftentimes already included with popular Linux desktop distributions.

You’ll need Secure Shell (SSH) access with root privileges to install the unrar and rar applications.

Installing and Using the unrar and rar Unix Terminal Application

You can check if unrar is installed running the unrar terminal command. If it isn’t installed already, log into SSH and follow the installation instructions for your operating system (OS). 

Install unrar Linux app on CentOS:

  1. Navigate to your temporary directory in SSH:
    cd /tmp/
  2. Visit the official WinRAR website – https://www.rarlab.com/download.htm.
  3. Right-click the latest RAR version for Linux x64 and select “Copy Link.”
  4. Type “wget” and paste the copied download link in your terminal to download RAR archiver. For example, to download RAR 6.02:
    wget https://www.rarlab.com/rar/rarlinux-x64-6.0.2.tar.gz
  5. Extract the RAR download:
    tar -zxvf rarlinux-x64-6.0.2.tar.gz
  6. Copy the extracted /rar and /unrar application directories into your /bin directory:
    cp -v rar/rar rar/unrar /usr/local/bin/

Install unrar on CentOS (with cPanel or FTP):

  1. Visit https://www.rarlab.com/download.htm.
  2. Download the latest RAR version for Linux x64 to your local machine.
  3. Upload the tar archive to your Linux VPS using FileZilla or cPanel File Manager.
  4. Extract the compressed archive.
  5. Log into SSH or WebHost Manager (WHM) Terminal as root.
  6. Navigate (cd) to the directory with the extracted rar archive.
  7. Copy the extracted /rar and /unrar application directories into your /bin directory:
    cp -v rar/rar rar/unrar /usr/local/bin/
  8. After testing that the rar and unrar commands work, you should remove the tar file.

Install unrar on Debian / Ubuntu (one of the following):

sudo apt-get install unrar-free
sudo apt install unrar-free
Installing unrar in Ubuntu Server

Install unrar on Arch / Manjaro:

sudo pacman -S unrar

Install unrar on FreeBSD:

sudo pkg install unrar

You can download the unrar macOS application from https://www.rarlab.com/download.htm.

How to unrar a file to the current directory:

unrar e file.rar

Create a rar archive:

rar a file.rar textfile.txt audiofile.mp3 videofile.flac

Password protect a rar archive:

unrar a -p file.rar

Then type a strong password twice.

Password Protect the rar archive

List archived files:

unrar l file.rar

Integrity check a rar file:

unrar t file.rar

Learn more about the unrar and rar applications:

man unrar
man rar

Now you have an additional terminal application when unable to use tar or zip.

No matter if you're a developer, system administrator, or simply a fan of SSH and command line, InMotion's Cloud Hosting plans provide a fast, scalable environment that is budget-friendly.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!