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 [-h|-V|-l|-n|-r|-f|-v] [-o DIR] [--flat] FILE...

PARAMETERS

-h, --help
    Display usage information and exit

-V, --version
    Output version information and exit

-l, --list
    List archive contents without extracting

-n, --no-clobber
    Do not overwrite existing files

-o DIR, --output=DIR
    Extract into specified DIR (default: named after archive)

-r, --recursive
    Recursively extract nested archives

-f, --force
    Overwrite files and make extracted files executable

-v, --verbose
    Increase output verbosity

--flat
    Do not create a containing directory

DESCRIPTION

dtrx is a universal extraction tool for Linux that automatically detects and extracts files from various archive formats without requiring users to remember specific commands for each type.

It supports common formats like tar, zip, rar, 7z, deb, rpm, and compressed files such as gz, bz2, and xz. Unlike traditional tools, dtrx handles nested archives recursively if specified, extracts to a named directory by default to avoid clutter, and lists contents before extraction.

Key features include non-interactive operation, overwrite protection, and verbose output. It's particularly useful for scripting or handling unknown archive types from downloads. dtrx relies on underlying tools like unzip, unrar, and 7z for actual extraction, making it a smart wrapper that simplifies workflows.

CAVEATS

Requires external tools like unrar, p7zip, unzip for full support; may fail on password-protected or corrupted archives; not installed by default on most distros.

SUPPORTED FORMATS

tar, zip, rar, 7z, deb, rpm, cpio, cab, lzh, plus compressions: gz, bz2, xz, lzma.

INSTALLATION

Available via package managers: apt install dtrx (Debian/Ubuntu), yum install dtrx (RHEL), or build from source.

HISTORY

Developed by Willi Richert in 2006 as 'Do The Right eXtraction'. Initially hosted on Google Code, now on GitHub. Maintained sporadically; last major release around 2012, but remains functional and popular in scripts.

SEE ALSO

tar(1), unzip(1), unar(1), 7z(1), unrar(1)

Copied to clipboard