rar file are a different compression file similar to zip. However, on Linux, it can be quite notorious.
On Linux, managing rar requires 2 packages. Hence, proceed to install them from your distribution. On Debian, it is:
$ sudo apt install rar unrar -y
To compress the files, you use the rar
command. A simple compression is:
$ rar a <rarfilename> <directory>
e.g.:
$ rar a docs.rar ./docs
To create a rar file with password encryption, use the -hp argument:
$ rar a -hp<password> <rarfilename> <directory>
e.g. with password 123456:
$ rar a -hp123456 docs.rar ./docs
To extract the rar package, you simply move the rar file into the designated directory (unrar will unpack right next to this file) and then use the unrar
program:
$ unrar x <rar file>
e.g.
$ unrar x doc.rar
To supply the password, simply use -p
argument:
$ unrar x -p<password> <rar file>
e.g. with password 123456:
$ unrar x -p123456 doc.rar
That's all about rar file in Linux.