Install Unrar Package

First you need to enable the repositories as shown below:

root@ip-172-31-28-131:~# sudo add-apt-repository multiverse

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

root@ip-172-31-28-131:~# apt update

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

root@ip-172-31-28-131:~# apt-get install unrar

To get the version of the package use:

root@ip-172-31-28-131:~# unrar -v

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

root@ip-172-31-28-131:~# 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”

root@ip-172-31-28-131:~# unrar e test.rar

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

root@ip-172-31-28-131:~# unrar e test.rar /home/

How to create a rar file

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

root@ip-172-31-28-131:~# apt-get install rar

Checking it’s version

root@ip-172-31-28-131:~# 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

# root@ip-172-31-28-131:~# 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:

root@ip-172-31-28-131:~# unrar l test.rar

 

Server Hosting Solutions by RackNerd:

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

Leave a comment

Your email address will not be published. Required fields are marked *