Install UNRAR on Rocky Linux 8

UNRAR is widely known and used amongst Windows users. RAR files are much smaller archives and compress better than ZIP for most files by compressing files “together,” saving more space. UNRAR does not come pre-installed natively on Rocky Linux and is not featured in its repositories.

The following tutorial will show you how to install UNRAR on Rocky Linux 8 Workstation or Server with RPM FUSION, along with the most commonly used commands.


  • Recommended OS: Rocky Linux 8.xx.
  • User account: A user account with sudo or root access.
  • Internet Access

The tutorial will utilize the terminal for the installation found in Activities > Show Applications > Terminal for desktop users.


Install UNRAR on Rocky Linux 8

Update Operating System

Update your Rocky Linux operating system to make sure all existing packages are up to date:

sudo dnf upgrade --refresh -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@rockylinux ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on How to Add a User to Sudoers on Rocky Linux.

Use the following command with the root password to log in to use the root account.


Install RPM Fusion Repository

By default, UNRAR is not available in Rocky Linux 8’s default repository, so you will need to install the famous RPM Fusion repository that contains the package along with many other free and proprietary popular packages.

To install the RPM Fusion repo’s in your terminal, you will execute the following commands.

Install/Enable the RPM Fusion Free Repository:

sudo dnf install --nogpgcheck -y

Install/Enable the RPM Fusion Non-Free Repository:

sudo dnf install --nogpgcheck -y

Next, verify the installation.

dnf repolist | grep rpmfusion

Example output:

rpmfusion-free-updates    RPM Fusion for EL 8 - Free - Updates
rpmfusion-nonfree-updates RPM Fusion for EL 8 - Nonfree - Updates

Install UNRAR

With RPM Fusion imported, you can now begin the installation. In your terminal, use the following command.

sudo dnf install unrar

Example output:

Install UNRAR on Rocky Linux 8

Type Y, then press the ENTER KEY to proceed.

Lastly, verify the version installed to make sure the installation was successful.

unrar -version | grep UNRAR

Example output:

UNRAR 6.01 freeware      Copyright (c) 1993-2021 Alexander Roshal

How to Use UNRAR

Below are some basic commands and examples of using UNRAR. While they do not show everything possible, they cover 75% of what most users would use UNRAR for regularly.

The first command that is most helpful before the tutorial continues further is the help command.


Example output:

Usage:     unrar <command> -<switch 1> -<switch N> <archive> <files...>
               <@listfiles...> <path_to_extract\>

  e             Extract files without archived paths
  l[t[a],b]     List archive contents [technical[all], bare]
  p             Print file to stdout
  t             Test archive files
  v[t[a],b]     Verbosely list archive contents [technical[all],bare]
  x             Extract files with full path

  -             Stop switches scanning
  @[+]          Disable [enable] file lists
  ad[1,2]       Alternate destination path
  ag[format]    Generate archive name using the current date
  ai            Ignore file attributes
  ap<path>      Set path inside archive
  c-            Disable comments show
  cfg-          Disable read configuration
  cl            Convert names to lower case
  cu            Convert names to upper case
  dh            Open shared files
  ep            Exclude paths from names
  ep3           Expand paths to full including the drive letter
  ep4<path>     Exclude the path prefix from names
  f             Freshen files
  id[c,d,n,p,q] Display or disable messages
  ierr          Send all messages to stderr
  inul          Disable all messages
  kb            Keep broken extracted files
  me[par]       Set encryption parameters
  n<file>       Additionally filter included files
  n@            Read additional filter masks from stdin
  n@<list>      Read additional filter masks from list file
  o[+|-]        Set the overwrite mode
  ol[a]         Process symbolic links as the link [absolute paths]
  op<path>      Set the output path for extracted files
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  r             Recurse subdirectories
  sc<chr>[obj]  Specify the character set
  si[name]      Read data from standard input (stdin)
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  ta[mcao]<d>   Process files modified after <d> YYYYMMDDHHMMSS date
  tb[mcao]<d>   Process files modified before <d> YYYYMMDDHHMMSS date
  tn[mcao]<t>   Process files newer than <t> time
  to[mcao]<t>   Process files older than <t> time
  ts[m,c,a,p]   Save or restore time (modification, creation, access, preserve)
  u             Update files
  v             List all volumes
  ver[n]        File version control
  vp            Pause before each volume
  x<file>       Exclude specified file
  x@            Read file names to exclude from stdin
  x@<list>      Exclude files listed in specified list file
  y             Assume Yes on all queries

Extract a RAR Archive Current Directory

To extract or open a RAR file in a current directory, use the unrar e command.

unrar e {file-name}.rar

Extract a RAR Archive to Folder

To extract or open a RAR file that needs a specific path or destination directory, use the following unrar e command again, followed by the full path of the final destination.

unrar e {file-name}.rar /target/path


unrar {filename}.rar /opt/

Extract a RAR Archive with Directory Structure

To extract a RAR archive with their directory structure, use the unrar x command.

unrar x {filename}.rar

List a RAR File

To list the files in a RAR file, use the following unrar l command. Additionally, list archive contents [technical[all], bare].

unrar l[technical[all], bare] {filename}.rar


unrar l[t[a],b] {filename}.rar

Test a RAR File

To test the files in a RAR file, use the following unrar t command.

unrar t {filename}.rar

Comments and Conclusion

In the tutorial, you have learned how to install UNRAR on Rocky Linux 8 and use the most common commands.

Overall, UNRAR is an excellent option for constant use of extensive archives that need compressing, especially if working between multiple operating systems such as Windows or macOS.


Like to get automatic updates? Follow us on one of our social media accounts!