HomeLinuxThe right way to Open, Extract and Create RAR Archive In Linux

The right way to Open, Extract and Create RAR Archive In Linux


RAR is the most well-liked software for creating and extracting compressed archive (.rar) recordsdata. Once we obtain an archive file from the online, we required a rar software to extract them.

RAR is on the market freely underneath Home windows working methods to deal with compressed recordsdata, however sadly, the rar software doesn’t pre-installed underneath Linux methods.

This text explains learn how to set up unrar and rar command-line instruments utilizing official binary tar recordsdata underneath Linux methods to open, extract, uncompress, or unrar an archive file.

Step 1: The right way to Set up Unrar on Linux

On Debian and Ubuntu-based distributions, you may simply set up unrar bundle utilizing the apt-get or apt program as proven.

$ sudo apt-get set up unrar
Or
$ sudo apt set up unrar

If you’re utilizing RHEL-based distributions, you should use the dnf command or yum command to put in it.

------------ On Fedora Linux ------------ 
$ sudo dnf set up unrar        

------------ On RHEL-based Linux ------------
$ sudo yum set up epel-release
$ sudo yum set up unrar

On different well-liked Linux distributions, you may set up it utilizing your default bundle supervisor as proven.

$ sudo emerge -a app-arch/unrar [On Gentoo Linux]
$ sudo apk add unrar            [On Alpine Linux]
$ sudo pacman -S unrar          [On Arch Linux]
$ sudo zypper set up unrar     [On OpenSUSE]    

In case your distribution doesn’t supply unrar bundle, it’s worthwhile to obtain the newest unrar/rar file and set up it utilizing the next instructions.

--------------- On 64-bit --------------- 
# cd /tmp
# wget https://www.rarlab.com/rar/rarlinux-x64-621.tar.gz
# tar -zxvf rarlinux-x64-621.tar.gz
# cd rar
# sudo cp -v rar unrar /usr/native/bin/

--------------- On 32-bit --------------- 
# cd /tmp
# wget https://www.rarlab.com/rar/rarlinux-x32-621.tar.gz
# tar -zxvf rarlinux-x32-621.tar.gz
# cd rar
# sudo cp -v rar unrar /usr/native/bin/

Step 2: The right way to Open/Extract a RAR File in Linux

To open/extract a RAR file within the present working listing, simply use the next command with the unrar e possibility.

# unrar e tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  index.php                                                 OK
Extracting  index.html                                                OK
Extracting  xyz.txt                                                   OK
Extracting  abc.txt                                                   OK
All OK

To open/extract a RAR file in a particular path or vacation spot listing, simply use the unrar e possibility, it is going to extract all of the recordsdata within the specified vacation spot listing.

# unrar e tecmint.rar /residence/

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  /residence/index.php                                           OK
Extracting  /residence/index.html                                          OK
Extracting  /residence/xyz.txt                                             OK
Extracting  /residence/abc.txt                                             OK
All OK

To open/extract a RAR file with its authentic listing construction, simply challenge the beneath command with the unrar x possibility. It’ll extract in line with their folder construction see beneath the output of the command.

# unrar x tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Creating    default                                                   OK
Extracting  default/index.php                                         OK
Extracting  default/index.html                                        OK
Creating    embody                                                   OK
Extracting  embody/abc.txt                                           OK
Creating    php                                                       OK
Extracting  php/xyz.txt                                               OK
All OK

Step 3: The right way to Record a RAR File in Linux

To checklist recordsdata inside an archive file use the unrar l possibility. It’ll show the checklist of recordsdata with their sizes, date, time, and permissions.

unrar l tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Archive tecmint.rar

 Identify             Dimension   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.php           0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    8                0       64   0%

Step 4: The right way to Check a RAR File in Linux

To check the integrity of an archive file, use possibility unrar t. The beneath command will carry out a whole integrity examine for every file and shows the standing of the file.

unrar t tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Testing archive tecmint.rar

Testing     tecmint/index.php                                         OK
Testing     tecmint/index.html                                        OK
Testing     tecmint/xyz.txt                                           OK
Testing     tecmint/abc.txt                                           OK
Testing     default/index.php                                         OK
Testing     default/index.html                                        OK
Testing     embody/abc.txt                                           OK
Testing     php/xyz.txt                                               OK
All OK

The unrar command is used to extract, checklist, or check archive recordsdata solely. It has no possibility for creating RAR recordsdata underneath Linux. So, right here we have to set up RAR command-line utility to create archive recordsdata.

Step 5: The right way to Set up Rar in Linux

To put in the RAR command possibility in Linux, simply execute the next command.

$ sudo apt set up rar         [On Debian, Ubuntu and Mint]
$ sudo yum set up rar         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
$ sudo emerge -a app-arch/rar  [On Gentoo Linux]
$ sudo apk add rar             [On Alpine Linux]
$ sudo pacman -S rar           [On Arch Linux]
$ sudo zypper set up rar      [On OpenSUSE]    

Pattern Output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Dependencies Resolved
=========================================================================================
 Package deal			Arch			Model				Repository			Dimension
=========================================================================================
Putting in:
 rar				i386            3.8.0-1.el5.rf      rpmforge			264 okay

Transaction Abstract
=========================================================================================
Set up       1 Package deal(s)
Improve       0 Package deal(s)

Complete obtain measurement: 264 okay
Is that this okay [y/N]: y
Downloading Packages:
rar-3.8.0-1.el5.rf.i386.rpm										| 264 kB     00:01
Working rpm_check_debug
Working Transaction Check
Completed Transaction Check
Transaction Check Succeeded
Working Transaction
  Putting in     : rar                                          1/1

Put in:
  rar.i386 0:3.8.0-1.el5.rf

Full!

Step 6: The right way to Create Rar File in Linux

To create an archive (RAR) file in Linux, run the next command with rar a possibility. It’ll create an archive file for a tecmint listing.

rar a tecmint.rar tecmint

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Analysis copy. Please register.

Creating archive tecmint.rar

Including    tecmint/index.php                                           OK
Including    tecmint/index.html                                          OK
Including    tecmint/xyz.txt                                             OK
Including    tecmint/abc.txt                                             OK
Including    tecmint                                                     OK
Finished

Step 7: The right way to Delete Information from the Archive

To delete a file from an archive file, run the command.

rar d filename.rar

Step 8: The right way to Recuperate Archives

To get well or repair an archive file or recordsdata, run the command with possibility rar r.

rar r filename.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Constructing mounted.tecmint.rar
Scanning...
Knowledge restoration report not discovered
Reconstructing tecmint.rar
Constructing rebuilt.tecmint.rar
Discovered  tecmintindex.php
Discovered  tecmintindex.html
Discovered  tecmintxyz.txt
Discovered  tecmintabc.txt
Discovered  tecmint
Finished

Step 9: The right way to Replace Archives

To replace or add recordsdata to the present archive file, use the next command with the choice rar u.

rar u tecmint.rar tecmint.sql

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Analysis copy. Please register.

Updating archive tecmint.rar

Including    tecmint.sql                                                 OK
Finished

Now, confirm that the file tecmint.sql is added to the archive file.

rar l tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Archive tecmint.rar

 Identify             Dimension   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 tecmint             0        0   0% 18-08-12 19:23 drwxr-xr-x 00000000 m0  2.0
 tecmint.sql 0 8 0% 18-08-12 19:46 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    6                0       40   0%

Step 10: The right way to Set Password to Archives

This can be a very attention-grabbing function of the Rar software, it permits us to set a password to the archive recordsdata. To password-protect archive recordsdata use possibility rar a -p.

rar a -p tecmint.rar

Enter password (is not going to be echoed):

Reenter password:

AR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Analysis copy. Please register.

Updating archive tecmint.rar

Updating  tecmint.sql                                                 OK
Finished

Now confirm it by extracting the archive file and see whether or not it is going to immediate us to enter the password that we’ve set above.

rar x tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Enter a password (is not going to be echoed) for tecmint.sql:

Extracting  tecmint.sql                                               OK
All OK

Step 11: The right way to Lock Archives

One other attention-grabbing lock function of the rar software, it supplies an choice to lock a specific archive file after extracting it.

rar okay tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware model         Sort RAR -? for assist

Processing archive tecmint.rar
Locking archive
Finished

Conclusion

For extra RAR and Unrar choices and utilization, run the next command it is going to show an inventory of choices with their description.

# man unrar
# man rar

Now we have offered nearly all the choices above for rar and unrar instructions with their examples. In the event you really feel that we’ve missed something on this checklist and you desire to us so as to add, please replace us utilizing the remark kind beneath.

If You Respect What We Do Right here On TecMint, You Ought to Think about:

TecMint is the quickest rising and most trusted neighborhood web site for any type of Linux Articles, Guides and Books on the internet. Tens of millions of individuals go to TecMint! to look or browse the hundreds of revealed articles obtainable FREELY to all.

In the event you like what you’re studying, please take into account shopping for us a espresso ( or 2 ) as a token of appreciation.

Support Us

We’re grateful on your by no means ending assist.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments