How to Install UNRAR on CentOS 9 Stream


UNRAR is a powerful tool for extracting compressed files, and it is widely 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 CentOS Stream and is not featured in its repositories, but it can be easily installed from a third-party repository. Once installed, UNRAR can be used to extract RAR files with a simple command. In addition, UNRAR offers a number of features for manipulating archives, such as the ability to list the contents of an archive or extract only certain files. As a result, UNRAR is a valuable tool for anyone who needs to work with compressed files.

The following tutorial will show you how to install UNRAR on CentOS 9 Stream workstation or server with EPEL, along with the most commonly used commands.

Update CentOS

First, ensure your system is up-to-date using the following command.

sudo dnf upgrade --refresh

Import EPEL Repository

The first task is to install the (EPEL) repository, which stands for (Extra Packages for Enterprise Linux). For newer users of CentOS Stream and similar distributions based on RHEL, EPEL contains the most commonly used software packages for Enterprise Linux.

First, enable the CRB.


sudo dnf config-manager --set-enabled crb

Next, install EPEL using the following (dnf) terminal command.

sudo dnf install \ \

Install UNRAR

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

sudo dnf install unrar -y

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

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

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

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

unrar x {filename}.rar

List a RAR File

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

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


unrar t {filename}.rar

Comments and Conclusion

If you’re looking for a great all-around compression utility that can handle archives of any size, UNRAR is an excellent option. It’s fast, efficient, and compatible with multiple operating systems, making it the perfect choice for anyone who needs to work with compressed files on a regular basis.

Share on: