Rar archived files are very common these days and in linux administration we have to find a solution for rar file extraction and compression in linux. To extract rar files we have the unrar application.
To use unrar to extract use the following commands:
unrar e <filename.rar> use this to unpack the rar file in current directory
unrar l <filename.rar> use this to list the files inside the archive
unrar x <filename.rar> use this to extract the files with the full path
unrar t <filename.rar> use this to test the integrity of archive
Now for those who wish to compress files into the rar archived format, we have the rar application and the following commands will come in handy:
rar a <desired filename.rar> <path of directory to archieve> use this to create a normal compressed rar archieve
rar a <desired filename.rar> <path to file1> <path to file2> <path to file3> … use this more multiple individual files to be archived into a sigle rar file.
rar a -p<password> <desired filename.rar> <path to dir or file> use this to password protect the rar files
rar a -m<level of compression 1-least 5-best> -v<size of each rar file> <desired filename.rar><path to dir or file> use this to split the file to a number of rar archived files of desired size.
Now to get all this and install the rar and unrar application, proceed with the following commands:
wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz
tar -zxvf rarlinux-3.6.0.tar.gz
cd rar
cp rar unrar /bin
For any further help, do contact our Linux administration team