rar
Create and extract RAR archives
TLDR
Archive 1 or more files
Archive a directory
Split the archive into parts of equal size (50M)
Password protect the resulting archive
Encrypt file data and headers with password
Use a specific compression level (0-5)
SYNOPSIS
rar <command> [-switch1] [-switch2] ... <archive_name> [<files...> | <@listfiles...>] [<destination_path>]
Common commands:
rar a <archive_name> <files...> (add files to archive)
rar x <archive_name> [<destination_path>] (extract files with full paths)
rar e <archive_name> [<destination_path>] (extract files to current directory)
rar l <archive_name> (list contents of archive)
rar t <archive_name> (test archive integrity)
PARAMETERS
a
Adds files to an archive. If the archive does not exist, it will be created.
x
Extracts files from an archive, recreating their full directory paths.
e
Extracts files from an archive to the current directory, ignoring original paths.
l
Lists the contents of an archive without extracting them.
t
Tests the integrity of the archive files.
-ad
Appends the archive name to the destination path during extraction.
-ap
Specifies a path prefix inside the archive for files being added or extracted.
-ep1
Excludes the base directory from file names when archiving or extracting.
-hp
Encrypts both file data and file headers using the specified password.
-idp
Displays the percentage indicator during operations.
-m<0-5>
Sets the compression method, where 0 is 'store' (no compression) and 5 is 'best' compression.
-o+
Sets the overwrite mode to 'overwrite all existing files' during extraction.
-o-
Sets the overwrite mode to 'do not overwrite existing files' during extraction.
-p
Encrypts file data using the specified password.
-r
Recurses subdirectories when archiving files.
-s
Creates a solid archive, which can improve compression for many small files.
-sfx
Creates a self-extracting archive (SFX) that can be run directly to extract its contents.
-v
Creates multi-volume archives, splitting them into parts of the specified size (e.g., '100m', '4g').
-x
Excludes specified files or files listed in a file from the operation.
-y
Assumes 'Yes' to all queries, useful for non-interactive operations.
DESCRIPTION
The rar command-line utility is the official tool for managing files in the proprietary RAR archive format. While it can create, modify, and list RAR archives, its primary use on Linux systems is often for extracting content from existing RAR files, which are frequently encountered due to their popularity on Windows platforms and for data distribution. Unlike many standard Linux archiving tools like tar or zip, rar is not open-source; the full version for creating archives is commercial trialware. For simple extraction, the unrar utility (often distributed separately or as a free component) is commonly used and often preferred as it's freely redistributable for extraction purposes.
RAR archives are known for their strong compression, especially with solid archiving, and support features like encryption, recovery records, and multi-volume archives.
CAVEATS
The rar archive format and the rar utility are proprietary software developed by RARLAB. While rar itself is often available for download on Linux, its full functionality for creating archives typically requires a commercial license after a trial period. For simple extraction of RAR archives, the open-source unrar utility is often preferred on Linux as it is freely redistributable and widely available in package repositories, though it generally cannot create new RAR archives. The proprietary nature means that the format specifications are not openly published, potentially limiting interoperability and long-term archival stability compared to open formats.
COMMON USE CASES
While rar can be used for creation, its most frequent use on Linux is to extract files from RAR archives downloaded from other sources, often created on Windows. The commands `rar x archive.rar` or `rar e archive.rar` are the most common operations for users.
LICENSING AND AVAILABILITY
The rar executable is not typically included in standard Linux distributions' repositories due to its proprietary license. Users usually need to download it directly from the RARLAB website or through third-party repositories. The unrar utility, however, is almost universally available in distribution repositories.
HISTORY
The RAR format and its associated tools were created by Eugene Roshal in 1993, with the name RAR standing for "Roshal ARchive". It quickly gained popularity on Windows platforms due to its strong compression ratios and features like multi-volume archives and recovery records, often outperforming ZIP in certain scenarios. While Windows users commonly interact with WinRAR, the command-line rar utility has been available for various platforms, including Linux, since its early days. Its proprietary nature and commercial licensing model for creation have led to the development and widespread adoption of the freely redistributable unrar utility for extraction purposes on open-source operating systems like Linux, where open formats and tools are generally preferred.