For those of you who didn’t know, RAR is most popular tool for creating and extracting compressed archive (.rar) files, but unfortunately rar tool doesn’t pre-installed under Linux systems, we need to install it using third-party tools to open, extract, uncompress or unrar a archive files. This tutorial will show how to ways install unrar and rar command-line tools using RPMforge repository CentOS with yum.
Step 1. To install, first you must add the rar/unrar yum repository information corresponding to your CentOS/RHEL version to yum:
For CentOS 5.x use:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
For CentOS 6.x use:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
#yum install rar unrar
Following are the some useful and helpful rar/unrar archive commands
# unrar x (file_name).rar extract with full path
# unrar e -kb (file_name).rar (Keep broken)
# unrar l (file_name).rar list files inside
# unrar e (file_name).rar dump files excluding folders
# rar a (file_name).rar (file_name) create a archive Rar file
# rar r (file_name).rar recover or fix a archive file or files
# rar a -p (file_name).rar create a archive Rar file with password