I wrote about a neat bash function before to extract the popular archive types without having to remember the right programs and options. Today I stumbled over a Python script that does exactly that and even more! It’s called dtrx – Do The Right Extraction. Created by Brett Smith.
Why would you want to install and use a Python script when there is a bash function? One or more of the following features:
- Handles many archive types: You only need to remember one simple command to extract tar, zip, cpio, deb, rpm, gem, 7z, cab, lzh, rar, gz, bz2, lzma, xz, and many kinds of exe files, including Microsoft Cabinet archives, InstallShield archives, and self-extracting zip files. If they have any extra compression, like tar.bz2 files, dtrx will take care of that for you, too.
- Keeps everything organized: dtrx will make sure that archives are extracted into their own dedicated directories.
- Sane permissions: dtrx makes sure you can read and write all the files you just extracted, while leaving the rest of the permissions intact.
- Recursive extraction: dtrx can find archives inside the archive and extract those too.