RAR is a proprietary archive file format that supports data compression, error recovery and file spanning. A .rar
file may contain one or more files or directories. rar
utility is used to compress file(s) and unrar
to extract.
Usage
-
Create a
.rar
archive from file(s):rar a archive.rar file1 file2
Note: the same command is used to add new files to existing archive.
Add-r
to include all dirs/files under the parent directory.
Add-p
to encrypt file data.
Add-hp
to encrypt both file data and headers.
Add-rr10
to add recovery records to the archive. This way up to 10% of the compressed archive can become corrupt or unusable, and it will be able to recover the data through parity. -
Create a
.rar
archive from file, while specifying the compression level (0 being worst, 5 best, and 3 default). For example, level 4:rar a -m4 archive.rar file1
-
Extract file(s) from archive:
unrar x archive.rar
-
Extract file(s) to specific directory:
unrar x archive.rar /home/$USER/Documents
-
Extract file(s) from archive to stdout:
unrar -p archive.rar
-
List all files in
archive.rar
:unrar l archive.rar
Use
v
instead for verbose output. -
Remove file(s) from archive:
rar d archive.rar file2
-
Test compressed archive data (
unrar
also can be used):rar t archive.rar
All Options
You can find all rar
and unrar
options in man pages:
man rar
man unrar