Dtrx: A Versatile Tool for Extracting Archives on Linux (tar, zip, rpm, and more)
09:17, 27.04.2026
Introduction to Dtrx
When working on Linux, managing archives such as .tar, .zip, .rpm, and others is a frequent task. While tools like tar and unzip can handle specific formats, switching between utilities for different archive types can be difficult. Enter dtrx (Do the Right Extraction), a versatile command-line utility designed to simplify archive extraction on Linux. It smartly handles various archive formats, automatically creating directories, managing nested archives, and ensuring proper permissions.
This article explores the features of dtrx, its installation process, and practical examples of how to use it effectively.
Key Features of Dtrx
- Supports Multiple Archive Formats: Handles formats like .tar, .zip, .rpm, .deb, .gem, and more.
- Metadata Extraction:Allows you to view metadata from .deb, .rpm, and .gem packages without full extraction.
- Automatic Directory Creation: Extracts files into a new directory named after the archive, avoiding clutter.
- Nested Archive Handling: Recursively unpacks archives contained within another archive.
- User-Friendly: Automates many manual extraction tasks while providing granular options for advanced users.
Installing Dtrx on Linux
In Ubuntu-based distributions dtrx tool is included by default; in this case, you can use the following command to install it:
sudo apt install dtrx
- For Fedora use: sudo dnf install dtrx
- For Arch Linux, use the AUR package: yay -S dtrx
- For other distributions, you can install it via pip: pip install dtrx
Using the dtrx Command on Linux
Once installed, dtrx simplifies archive extraction with its intelligent features. Let’s explore its capabilities through practical examples.
1. Unpacking a Single Archive
Extracting a single archive is as simple as using the dtrx command followed by an archive name. For example:
dtrx file.tar.gz
This creates a directory named file and extracts the archive contents.
2. Handling Multiple Archives at Once
If you have a file that consists of multiple archives, instead of extracting each of them manually, you can extract all of them at once by using the “a” option that performs a recursive extraction:
dtrx dtrAll.zip
You can additionally verify the contents of the extracted directory by using the Is command:
cd dtrAll ls
3. Selecting a Specific Archive to Extract
If you need to extract the main archive and not the nested archives, use the following command:
dtrx dtrAll.zip
4. Unpacking Nested Archives
Say you want to extract a specific layer of archives, a second one, and not the third, you can use the “o” option.
For example, you have “dtrNewAll.zip“, which consists of “dtrAll.zip” and “dtrNew“. If you want to extract the “dtrNewAll” and “dtrAll” but not those archives down the hierarchy, you can use:
dtrx dtrNewAll.zip
5. Extracting Metadata from .deb, .rpm, and .gem Files
To extract metadata, use the “m” option:
dtrx -m openfire_4.9.0_all.deb dtrx -m openfire-4.9.0-1.noarch.rpm dtrx -m openfire-4.9.0.gem
6. Extracting Files into a Separate Directory
Specify a custom directory for extraction with:
dtrx -d custom_directory archive.tar.gz
7. Viewing Supported Archive Formats
To see all formats supported by dtrx, run:
dtrx --help
Dtrx is a powerful utility for Linux users who often work with various archive formats. Its intelligent handling of different scenarios, from nested archives to metadata extraction, makes it a valuable addition to your command-line toolkit.