RAR¶
Format: .rar (RAR4 and RAR5) · Type: proprietary archive · First released: 1993 (Eugene Roshal)
RAR was hugely popular on Windows and in file-sharing circles, thanks to good compression, easy multi-volume archives, and recovery records that can repair damage. The format is proprietary: anyone can decompress it, but only RARLAB's rar can create it.
On Linux you'll usually just need to extract RAR files.
Extracting¶
| Tool | Licence | Notes |
|---|---|---|
unrar |
Freeware (non-free) | Official RARLAB extractor; full RAR5 support |
unar / lsar |
Open source | The Unarchiver; reads RAR and dozens of other formats |
7z |
Open source | 7-Zip reads RAR4 and RAR5 |
bsdtar |
Open source | libarchive has partial RAR support |
unrar x archive.rar # extract with full paths
unrar x archive.rar /tmp/dest/ # into a directory
unrar e archive.rar # extract flat
unrar l archive.rar # list
unrar t archive.rar # test
unrar x -p archive.rar # prompt for a password
unar archive.rar # creates a folder if needed
unar -o /tmp/dest archive.rar
lsar archive.rar
7z x archive.rar
unrar-freeis a different, older open-source tool with incomplete RAR5 support. If extraction fails, tryunrar,unaror7z.
Multi-volume sets¶
# New-style names: archive.part1.rar, archive.part2.rar, ...
unrar x archive.part1.rar
# Old-style names: archive.rar, archive.r00, archive.r01, ...
unrar x archive.rar
Point the tool at the first volume; it finds the rest.
Creating (requires the paid rar tool)¶
rar a archive.rar src_dir/ # create
rar a -m5 archive.rar src_dir/ # best compression
rar a -rr5% archive.rar src_dir/ # add a 5% recovery record
rar a -v100m archive.rar big_dir/ # 100 MB volumes
rar a -hp archive.rar src_dir/ # encrypt data and headers (prompts)
rar r damaged.rar # repair using the recovery record
For anything you're creating yourself, 7-Zip or a tarball avoids the proprietary dependency.