unrar
Extract files from RAR archives
TLDR
Extract files with original directory structure
Extract files to a specified path with the original directory structure
Extract files into current directory, losing directory structure in the archive
Test integrity of each file inside the archive file
List files inside the archive file without decompressing it
SYNOPSIS
unrar <command> [options] <archive> [files_to_extract...] [destination_path]
Common commands:
unrar e [options] <archive> [files...] [destination_path] (Extract files to current directory)
unrar x [options] <archive> [files...] [destination_path] (Extract files with full paths)
unrar l [options] <archive> (List archive contents)
PARAMETERS
e
Extract files to the current directory, ignoring stored path information.
x
Extract files with full paths, recreating the original directory structure.
l
List the contents of the archive.
t
Test the integrity of the archive files.
v
Verbosely list the contents of the archive, including technical details.
-p<password>
Set the password for decrypting encrypted files. If not provided for an encrypted archive, unrar will prompt.
-o[+|-|r]
Specify overwrite mode for existing files: + for overwrite all files, - for skip existing files, or r for rename.
-ad
Append the archive name to the destination path, creating a subdirectory with the archive's name.
-ap<path>
Prepend the specified path prefix to all extracted file names.
-ep
Exclude paths from extracted file names, extracting all files directly into the destination directory.
-ep1
Exclude the base directory from extracted file names (e.g., if archive contains 'myarchive/files', only 'files' will be extracted).
-id[c,d,p,q]
Disable specific messages: c (copyright), d (done), p (percentage), q (all quiet).
-kb
Keep broken (partially extracted) files after extraction errors.
-y
Assume Yes on all queries (e.g., overwrite prompts), useful for scripting.
-x<file_mask>
Exclude files or directories matching the specified mask from extraction.
DESCRIPTION
unrar is a command-line utility for extracting files from RAR archives on Unix-like operating systems. RAR (Roshal ARchiver) is a proprietary file format commonly used for data compression and archiving, especially prevalent in the Windows environment.
The unrar command allows users to decompress and restore the original files and directory structures stored within these archives. It supports various versions of the RAR format, including older RAR1.50, RAR2, RAR3, and newer RAR5. Key functionalities include handling single and multi-volume archives (split archives), password-protected files, and various compression methods.
While the rar utility (the full suite) can both create and extract archives, the unrar command commonly found on Linux distributions is often the freeware version distributed by RARLAB, which is designed solely for extraction purposes. This makes it an essential tool for interacting with RAR compressed data without needing the proprietary creation tools.
CAVEATS
The unrar command is primarily an extraction-only tool. Unlike some other archive utilities (like tar or zip), it cannot create RAR archives; for that, the proprietary rar utility from RARLAB is required, which typically needs a commercial license.
Users should ensure they have the unrar package installed on their system, as it's not always bundled by default with minimal Linux installations. While unrar supports a wide range of RAR versions, compatibility issues might occasionally arise with very old or very new, highly specialized RAR archives. The command-line nature requires familiarity with options and file paths.
PASSWORD PROTECTION
unrar supports extracting files from password-protected RAR archives. The password can be provided using the -p<password> option directly in the command, or unrar will prompt the user to enter it if required during extraction.
MULTI-VOLUME ARCHIVES
unrar seamlessly handles multi-volume (split) RAR archives. When extracting, ensure all parts of the archive (e.g., files named .part1.rar, .part2.rar, or .rar, .r00, .r01 etc.) are present in the same directory. unrar will automatically detect and process them in sequence starting from the first volume.
HISTORY
The RAR (Roshal ARchiver) format and its associated tools were developed by Eugene Roshal. While the rar archiving utility is proprietary, RARLAB (the developers) released a freeware version of the unrar utility for various platforms, including Unix-like systems, specifically for extraction. This decision was crucial for the format's widespread adoption and interoperability, allowing users on Linux, macOS, and other systems to extract RAR archives commonly created on Windows.
Over time, unrar has evolved to support new RAR format versions, like RAR5, ensuring its continued relevance as a tool for decompressing files distributed in this popular format. Its primary usage lies in accessing content from archives created by Windows users who favor the RAR format for its compression efficiency and features like recovery records and multi-volume splitting.