• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to extract RAR files in CentOS/RHEL 7 and 8

by admin

There is no default utility in CentOS/RHEL 7 systems to extract a .rar file. This post outlines the steps to install the unar package and use of unar command to extract files with .rar extension.

1. Log in as a root user (or use sudo) and configure the latest EPEL repositories to be able to install the unar package:

# yum install epel-release
Note: I recommend to disable all the existing repositories and just enable the EPEL repository if you do not want to face any conflict.

2, Now you should be able to see the just configured repository:

# yum clean all
# yum repolist

You should be able to see the unrar package listed as well using the below command.

# yum info unar*

For example:

# yum info unar*
Loaded plugins: ulninfo
Available Packages
Name : unar
Arch : x86_64
Version : 1.10.1
Release : 1.el7
Size : 1.9 M
Repo : EPEL
Summary : Multi-format extractor
URL : http://unarchiver.c3.cx/commandline
License : LGPLv2+
Description : The command-line utilities lsar and unar are capable of listing and extracting
: files respectively in several formats including RARv3. unar can serve as a free
: and open source replacement of unrar.

#

3. Now proceed to install the package:

# yum install unar -y

4. Once the package is installed, now is possible to extract RAR files. Use the unrar command to extract the .rar files.

# unar [file_name.rar]

For example:

# ll
total 8
-rw-r--r--. 1 root root 72 May 6 10:48 test.rar
#
# file test.rar
test.rar: RAR archive data, v8, os: MS-DOS
#
# unar test.rar
test.rar: RAR 5
test.txt (0 B)... OK.
Successfully extracted to "./test.txt".
#
# ll
total 8
-rw-r--r--. 1 root root 72 May 6 10:48 test.rar
-rw-r--r--. 1 root root 0 May 6 10:48 test.txt
#

Note: View the man page of unrar command for more information and options available.

# man unrar

If you move the original repositories at the beginning of the post, move them back to original place and perform a “clean all”

# yum clean all
# yum repolist

Filed Under: CentOS/RHEL, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. “az storage blob” Command Examples (Manage blob storage containers and objects in Azure)
  2. snmpwalk: command not found
  3. a2ensite: command not found
  4. How to uninstall cmake package from Ubuntu
  5. CentOS / RHEL : How to Disable and Blacklist Linux Kernel Module to prevent it from loading automatically
  6. dget Command Examples in Linux
  7. Understanding the /proc/mounts, /etc/mtab and /proc/partitions files
  8. Detect and Scan New Luns in CentOS/RHEL
  9. How to configure NTP server and client in CentOS / RHEL 7
  10. radeontop Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright