How to Extract/Open RAR File in Linux or UNIX System
In Linux or Unix operating system you will not see unrar command because unrar is not installed by default. RAR (Roshal Archive) is a compressed and archive file format. You will need to unrar or unpack (extract) if you have downloaded rar files from internet. It is developed by Eugene Roshal. Unrar command is used to extract the rar files. To extract these files you will need to install unrar command. In this tutorial I am going to explain how we can install unrar command on Linux or UNIX system.
Install Unrar Package
Follow the below command to install unrar command on Linux or UNIX system.
On Ubuntu and debian system : You will need to type apt-get command to get the unrar package follow the below command.
# apt-get install unrar
On Linux/RHEL/CentOs and Fedora system: You can use yum command if you are using Fedoran Linux/Rhel/CentOS system.
# yum install unrar
You can also download binary package from official rarlab website if above command not working on your system.
# mkdir /root/download # cd /root/download # wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz --2017-01-17 09:05:28-- http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz Resolving www.rarlab.com (www.rarlab.com)... 18.104.22.168 Connecting to www.rarlab.com (www.rarlab.com)|22.214.171.124|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 752997 (735K) [application/x-gzip] Saving to: ‘rarlinux-3.6.0.tar.gz’ rarlinux-3.6.0.tar.gz 100%[=====================================================================================>] 735.35K 1.54MB/s in 0.5s 2017-01-17 09:05:29 (1.54 MB/s) - ‘rarlinux-3.6.0.tar.gz’ saved [752997/752997]
OR you can also try for 64 bit version:
# wget http://www.rarlab.com/rar/rarlinux-x64-5.3.b4.tar.gz
After downloading binary package you will need to untar the file.
# tar -zxvf rarlinux-3.6.0.tar.gz rar/ rar/file_id.diz rar/license.txt rar/Makefile rar/order.htm rar/rarfiles.lst rar/rar.txt rar/readme.txt rar/technote.txt rar/whatsnew.txt rar/rar rar/rar_static rar/unrar rar/default.sfx
You can find both rar and unrar command in rar sub-directory. Go to rar directory and execute below command.
# ls rar rarlinux-3.6.0.tar.gz # cd rar # ls default.sfx file_id.diz license.txt Makefile order.htm rar rarfiles.lst rar_static rar.txt readme.txt technote.txt unrar whatsnew.txt # ./unrar
You will need to copy rar and unrar file to /usr/local/bin/ directory.
# cp rar unrar /usr/local/bin/
Now rar and unrar command has been installed on your system.
Unrar Command Usage
There are lots of unrar command options, here I am going to explain common options.
Extract/Unpack rar file
Follow the below command to extract rar file into the current directory.
# unrar e myfile.rar
List file from rar archive
# unrar l myfile.rar
Extract file with full path
# unrar x myfile.rar
Test integrity of archive file
# unrar t myfile.rar
I hope this article will be helpful to understand how we can extract and unpack RAR files on Linux or UNIX system. Read our another article. If you have any queries and problem please comment in comment section.