Rar - Arch Linux 中文维基

跳至內容

# Rar

出自 Arch Linux 中文维基

本文或本節內容已經過時。

原因： 請提供模板的第一個位置參數以概括原因。 (在Talk:Rar討論)

RAR (and UNRAR) is the Linux port of the commandline-only version of WinRAR available in both the i686 and x86-64 flavors.

## 主要特點

- Variable amounts of redundancy ("recovery record" or "recovery volumes" both of which are demonstrated below) can be added to an archive, making it more resistant to corruption. Even if parts of an archive are damaged, it is possible to fully recover the stored data if a large enough recovery record exists. On its own, Tar does not have this ability.
- RAR is able to efficiently handle split volumes. Built-in support for multi-volume files enables the unpacking program to simply prompt the user for the next .partXXX RAR file, without the need to manually copy and then rejoin the pieces, or for extracting a file from a single piece without needing all pieces. RAR does not support tapes, as it uses seek and rename operations on its files.
- RAR archives can be of a solid format, in which all of the compressed files are treated as a single data block. Most currently used compression formats (with the exception of the older ZIP) allow solid structuring.
- Strong encryption capabilities. Older versions of the file format used a proprietary algorithm; newer versions use the AES encryption algorithm, a block cipher adopted as an encryption standard by the U.S. government. The only known ways to recover an encrypted file are via dictionary or brute force attacks. In newer versions, password protection can optionally protect filenames too, so that the filenames contained within the archive will not be displayed without the right password.

## 安裝

### RAR

可以通過 AUR 來安裝 rarAUR（除 UNRAR 外的所有功能）。

### UNRAR

官方倉庫單獨提供了 unrar包 ，可以像平常一樣通過 pacman 來安裝。

## 配置文件

Linux 版的 RAR 從 `~/.rarrc` （即用戶的 home 目錄下）讀取配置信息，又或者可以在 /etc 目錄下，定義一個全局配置文件，供所有用戶使用。

這個文件的語法如下：

    switches=any RAR switches, separated by spaces

舉個例子：

    switches=-m5 -rr5 -ol -msjpg;mp3;avi;zip;rar;tar;gz;jpg

要想獲得關於 RAR 選項的完整清單及詳細解釋，可以訪問用戶手冊。

## RAR 壓縮例子

### 基本語法

    $ rar command -switch 1 -switch N archive files.rar @listfiles...

要想獲得完整的命令及選項，請參閱本文的最後一部分，或者運行 `rar` 。

### Recursively compress an entire directory structure

- Task: backup `/home/darkhorse` to `/media/data/darkhorse-backup.rar` using 10 % recovery records:

    $ rar a -r -rr10 /media/data/darkhorse-backup.rar /home/darkhorse

- Explained:

Switch | Action
a | adds files to archives.
-r | recurse subdirectories (includes all dirs/files under the parent directory).
-rr10 | adds 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.

### Mixed-mode archives

You can also use mixed-mode archives which means that file types you specifiy do not get compressed - they simply get stored.

- Task: backup `/home/darkhorse` to `/media/data/darkhorse-backup.rar`:

    $ rar a -r -rr10 -s -m5 -msjpg;mp3;tar /media/data/darkhorse-backup.rar /home/darkhorse

- Explained:

Switch | Action
a | adds files to archives.
-r | recurse subdirectories (includes all dirs/files under the parent directory).
-rr10 | adds 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.
-m5 | Use the highest level of compression (m0 = store ... m3 = default ... m5 = maximal level of compression.
-msjpg;mp3;tar | ignore the compression option and store all .jpg and .mp3 and .tar files.

### Recursively compress many directory structures using a list

- Task: backup `/home/darkhorse` and `/home/palomino` and `/home/seabiscuit` to `/media/data/homes-backup.rar`.

First create a list (simple text file) containing the various targets. In this example, the list will be three lines long. I named it 'home-list' in this example but you can call it anything you want:

    /home/darkhorse
    /home/palomino
    /home/seabiscuit

    $ rar a -r -rr10 -s /media/data/homes-backup.rar @/path/to/home-list

## UNRAR 例子

### 基本語法

    $ unrar command -switch 1 -switch N archive files... @listfiles... path_to_extract\

想了解完整的命令及選項，只需運行：

    $ unrar --help

解壓到一個新的目錄：

    $ unrar x /media/data/homes-backup.rar homes-backup/

運行以下命令，來解壓分卷壓縮文件：

    $ unrar x homes-backup.part1.rar homes-backup/

分類：​

- 使用「模板:過時」標記的頁面或章節
- 數據壓縮與歸檔

Rar
新增話題