LinuxCommandLibrary

dtrx

Extract multiple archive types easily

TLDR

Extract archive, guessing the extraction tool from extension

$ dtrx [path/to/file]
copy

Extract archive, overwrite any existing target output
$ dtrx --overwrite [path/to/file]
copy

Extract archive, put everything into current directory
$ dtrx --flat [path/to/file]
copy

SYNOPSIS

dtrx [OPTIONS] ARCHIVE [ARCHIVE...]

PARAMETERS

-r, --recursive
    Recursively extract archives found within other archives.

-l, --list
    List the contents of the specified archive(s) without extracting them.

-o , --output
    Extract all archives into the specified output directory.

-N, --always-directory
    Always create a new subdirectory for the extracted contents, even if there's only one file or if the archive name is not generic.

-M, --no-directory
    Never create a new subdirectory for the extracted contents. Files will be placed directly in the current working directory or the specified output directory.

-f, --force
    Overwrite existing files without prompting for confirmation.

-n, --noninteractive
    Do not prompt for any user input. This implies '-f' and assumes 'yes' to all questions.

-q, --quiet
    Suppress most output messages during extraction.

-v, --verbose
    Increase the verbosity of output messages, showing more details about the extraction process.

-s, --sudo
    Use sudo when invoking external extraction programs, useful for extracting archives with root-owned contents.

-i, --ignore-errors
    Continue processing other archives even if one archive fails to extract.

DESCRIPTION

dtrx, short for "Do The Right Extraction", is a powerful and convenient command-line utility designed to simplify archive extraction on Linux and Unix-like systems. It acts as a universal frontend for various specialized extractors like tar, unzip, unrar, 7z, and many others, intelligently determining the archive type and invoking the appropriate tool.

Its primary goal is to make archive handling straightforward by automating common decisions, such as whether to create a new subdirectory for extracted contents, handling multiple archives, and dealing with conflicting filenames. dtrx minimizes the need for users to remember specific commands or complex options for different archive formats, offering a consistent and user-friendly experience across the board.

CAVEATS

dtrx relies heavily on the availability of underlying extraction programs (e.g., tar, unzip, unrar, 7z). If these tools are not installed on your system for a specific archive type, dtrx will not be able to extract that format. Its 'intelligent' default behavior, while convenient, can sometimes be overridden by explicit options if a user prefers more manual control over directory creation.

INTERACTIVE PROMPTS

A core feature of dtrx is its interactive nature. By default, if there are multiple options for where to place the extracted files (e.g., current directory or a new subdirectory), or if a file conflict arises, dtrx will prompt the user for input. This behavior can be altered using options like -n (non-interactive) or -f (force overwrite).

DEPENDENCIES

dtrx acts as a wrapper. It does not contain built-in extraction logic for every format. Instead, it detects the archive type and then calls the appropriate system utility (like tar for .tar.gz, unzip for .zip, etc.). This means that the user must have the necessary underlying tools installed for dtrx to function correctly with all archive types.

HISTORY

Developed by Ben Cohen, dtrx was created to address the common frustration of remembering myriad archive commands and their specific flags. It aimed to provide a single, consistent interface for handling nearly all archive formats. While an exact historical timeline is elusive, it gained popularity in the Linux community for its convenience and has been maintained and used for over a decade as a go-to extraction utility.

SEE ALSO

tar(1), gzip(1), bzip2(1), xz(1), zip(1), unzip(1), rar(1), unrar(1), 7z(1)

Copied to clipboard