Install Unrar Package

First you need to enable the repositories as shown below:

[email protected]:~# sudo add-apt-repository multiverse

Then you need to update the package cache using the command:

[email protected]:~# apt update

Now, you need to install the package as shown below:

[email protected]:~# apt-get install unrar

To get the version of the package use:

[email protected]:~# unrar -v

On CentOS and AlmaLinux based servers, use the command mentioned below to install unrar.

[email protected]:~# yum install unrar or use yum install unrar-free

How to extract a rar file

First we can download a rar file and see how it can be extracted using the command unrar.

Here, we are extracting a file named “test.rar”

[email protected]:~# unrar e test.rar

If we want to extract the file to a specific location called “/home”, use the command mentioned below:

[email protected]:~# unrar e test.rar /home/

How to create a rar file

To create a rar file, we need to install the package named “rar”.

[email protected]:~# apt-get install rar

Checking it’s version

[email protected]:~# rar -v

Now, we can create a rar file using the command mentioned below.

Here, the file which will be archived will be “test.php

# [email protected]:~# rar a test.php.rar test.php

How to list files in rar file

Here, we can take the file “test.rar”, and to list the files inside it, use the command mentioned below:

[email protected]:~# unrar l test.rar


Server Hosting Solutions by RackNerd:

Shared Hosting
cPanel Web Hosting in US, Europe, and Asia datacenters
Reseller Hosting
Create your new income stream today with a reseller account
VPS (Virtual Private Server)
Fast and Affordable VPS services - Instantly Deployed
Dedicated Servers
Bare-metal servers, ideal for the performance-demanding use case.

Leave a comment

Your email address will not be published.