unar
Extract archives of various formats
TLDR
Extract an archive to the current directory
Extract an archive to the specified directory
Force overwrite if files to be unpacked already exist
Force rename if files to be unpacked already exist
Force skip if files to be unpacked already exist
SYNOPSIS
unar [options] <archive_file> [files_to_extract...]
PARAMETERS
-o <directory>
Specifies the output directory where the archive contents will be extracted.
-p <password>
Provides the password for encrypted archives.
-f
Forces overwriting of existing files without prompting.
-d
Creates a new directory with the archive's name to extract contents into. This is the default behavior.
-D
Disables the default behavior of creating a new directory. Contents are extracted directly into the current or specified output directory.
-e
Extracts files maintaining their exact directory structure as stored in the archive.
-r
Recurses into sub-archives or embedded archives found within the main archive.
-i
Disables interactive prompting for overwriting or passwords, typically assuming 'no' for overwrites unless '-f' is also used.
-k
Skips extraction of files that would overwrite existing files.
-v
Enables verbose output, showing more details about the extraction process.
--help
Displays a help message with command options and usage.
--version
Shows the version information of the unar utility.
DESCRIPTION
unar is a command-line utility from The Unarchiver project, designed to extract files from a wide variety of archive formats. Unlike traditional tools often dedicated to one or a few formats (like `unzip` for ZIP files or `tar` for TAR archives), unar aims to be a single, universal solution. It prioritizes robust handling of corrupted or unusual archives, making it a reliable choice for diverse extraction needs.
It supports over 50 different archive types, including popular ones like Zip, RAR, 7z, Tar, Gzip, and Bzip2, as well as less common ones like CAB, MSI, NSIS, ISO images, and segmented files. unar is known for its ability to correctly handle filenames with non-ASCII characters and for its generally safer approach to extraction by not using external helper applications.
CAVEATS
While unar supports a vast array of formats, some extremely obscure or highly specialized archive types might not be fully supported. It is solely an extraction tool and cannot be used to create or compress archives. Performance can vary depending on the archive format, compression method, and size, though it is generally optimized.
DEFAULT EXTRACTION BEHAVIOR
By default, unar extracts all contents of an archive into a newly created directory named after the archive, preserving the internal directory structure. For example, extracting `archive.zip` will create `archive/` and place contents inside it.
FILENAME ENCODING
unar is generally proficient in handling various character encodings for filenames within archives, making it highly compatible with archives created on different operating systems and locales, which is a common challenge for older extraction utilities.
HISTORY
unar is the command-line utility component of The Unarchiver project, originally developed by Dag Ă…gren. The project emerged on macOS to provide a more robust and comprehensive solution for extracting various archive formats than the built-in system tools. It gained significant popularity due to its reliability, broad format support, and ability to correctly handle filenames with non-ASCII characters and other common archive issues. unar was subsequently ported to Linux and other Unix-like systems, making its powerful extraction capabilities available cross-platform. Its ongoing development focuses on safe and efficient extraction, aiming to minimize external dependencies.