Introduction
RAR is a well known file format for archives associated with application for Microsoft Windows such as WinRAR. The goal of this article is to explain how to install and use rar under Linux.
Download and Install RAR under Linux
Download
Check at rarlab.com for the latest stable releases and download appropriate version for your Linux (32bit or 64bit).
wget http://www.rarlab.com/rar/rarlinux-3.9.0.tar.gz
Install
Extract the downloaded content and move it at appropriate directory. In the example the directory is /opt/rar/ and the commands are executed by root user.
[leon@localhost Download]$ tar -xzf rarlinux-3.9.0.tar.gz
[root@localhost Download]# mv rar /opt/
Register RAR to the Other Linux Application
This last step is optional because it's puprose is only to provide comfort to all users of the system. The example demostrates how to create a symbolic link at /usr/bin/ to the rar application.
[root@localhost Download]# ln -sf /opt/rar/rar /usr/bin/rar
Create a RAR Archive
To add files to archive and to compress them with RAR use the command rar. The first argument must be a, the second the name of the new file and then all names files and/or directories which should be included separated by comma.
[leon@localhost Download]# rar a MyRarFile.rar test.txt
RAR 3.90 Copyright (c) 1993-2009 Alexander Roshal 16 Aug 2009
Shareware version Type RAR -? for help
Evaluation copy. Please register.
Creating archive MyRarFile.rar
Adding test.txt OK
Done
Extract an Archive
To extract content of an archive file use the rar command with the e argument followed by the name of the archive.
[leon@localhost Download]# rar e MyRarFile.rar
RAR 3.90 Copyright (c) 1993-2009 Alexander Roshal 16 Aug 2009
Shareware version Type RAR -? for help
Extracting from MyRarFile.rar
Extracting test.txt OK
All OK
Links
WinRAR and RAR release
|