How to Install dtrx in Linux

An Intelligent Archive Extraction Tool Dtrx for Linux

Dtrx - “ Do The Right Extraction“ is an effective command line application for Unix-like systems to make extractions easier. The dtrx command is an replacement of “ tar -zxvf” or “ tar -xjf” commands. It is also used to decompress files compressed with bzip2, gzip etc. It provides single command to extract archives in a number of different formats including tar, zip, rpm, deb, gem, 7z, cpio, rar etc.

Features of Dtrx

  • Recursive extraction which is responsible for finding and extracting the archives.
  • Same permissions, which allows users to write and read the files.
  • Keeps everything organized, which extracts archives,
  • Handles various archive types, which give only one simple command for extraction.
  • InstallShield archives
  • Self-extracting zip files

Installation of Dtrx in Linux

On CentOS/RHEL/Fedora

Download a dtrx package.

[root@linuxhelp Downloads]# wget http://brettcsmith.org/2007/dtrx/dtrx-7.1.tar.gz
--2016-06-04 17:11:02--  http://brettcsmith.org/2007/dtrx/dtrx-7.1.tar.gz
Resolving brettcsmith.org (brettcsmith.org)... 185.111.203.77, 2605:bb80:2000:10::2:1
Connecting to brettcsmith.org (brettcsmith.org)|185.111.203.77|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41706 (41K) [application/x-gzip]
Saving to: ‘ dtrx-7.1.tar.gz’ 

100%[===========================================> ] 41,706      82.4KB/s   in 0.5s   

2016-06-04 17:11:03 (82.4 KB/s) - ‘ dtrx-7.1.tar.gz’  saved [41706/41706]


Once the download is completed, extract the tar package.

[root@linuxhelp Downloads]# tar -xvf dtrx-7.1.tar.gz
dtrx-7.1/
dtrx-7.1/scripts/
dtrx-7.1/scripts/dtrx
dtrx-7.1/NEWS
.
.
.
.
dtrx-7.1/tests/test-1.23.7z
dtrx-7.1/tests/test-1.23.zip
dtrx-7.1/tests/test-1.23.lzh
dtrx-7.1/tests/test-onefile.tar.gz
dtrx-7.1/PKG-INFO


Now move to the directory and run the script to install dtrx.

[root@linuxhelp Downloads]# cd dtrx-7.1/
[root@linuxhelp dtrx-7.1]# python setup.py install --prefix=/usr/local
running install
running build
running build_scripts
creating build
creating build/scripts-2.7
copying and adjusting scripts/dtrx ->  build/scripts-2.7
changing mode of build/scripts-2.7/dtrx from 644 to 755
running install_scripts
copying build/scripts-2.7/dtrx ->  /usr/local/bin
changing mode of /usr/local/bin/dtrx to 755
running install_egg_info
Removing /usr/local/lib/python2.7/site-packages/dtrx-7.1-py2.7.egg-info
Writing /usr/local/lib/python2.7/site-packages/dtrx-7.1-py2.7.egg-info

dtrx Command Usage

Extraction of Single Archive

Run the dtrx command, if you wish to extract an archive file known as “ desktop.tar.bz2 “ . During the execution of this command, it asks a question for extraction type.

First select “ I” it extract that tar file by the name of tar file name.



[root@linuxhelp Desktop]# dtrx desktop.tar.bz2 
desktop.tar.bz2 contains one directory but its name doesn' t match.
 Expected: desktop
   Actual: home/
You can:
 * extract the directory _I_nside a new directory named desktop
 * extract the directory and _R_ename it desktop
 * extract the directory _H_ere
What do you want to do?  (I/r/h) I
[root@linuxhelp Desktop]# ls
desktop          deskzip.zip  google-chrome-stable_current_amd64.deb
desktop.tar.bz2  dir.zip      google-chrome-stable_current_x86_64.rpm


Now on selecting “ r” it extracts that tar file and rename it.

[root@linuxhelp Desktop]# dtrx desktop.tar.bz2 
desktop.tar.bz2 contains one directory but its name doesn' t match.
 Expected: desktop
   Actual: home/
You can:
 * extract the directory _I_nside a new directory named desktop
 * extract the directory and _R_ename it desktop
 * extract the directory _H_ere
What do you want to do?  (I/r/h) r
dtrx: WARNING: extracting /home/user1/Desktop/desktop.tar.bz2 to desktop.1
[root@linuxhelp Desktop]#


On selecting “ h” it extracts that tar file at the same tar file path.

[root@linuxhelp Desktop]# dtrx desktop.tar.bz2 
desktop.tar.bz2 contains one directory but its name doesn' t match.
 Expected: desktop
   Actual: home/
You can:
 * extract the directory _I_nside a new directory named desktop
 * extract the directory and _R_ename it desktop
 * extract the directory _H_ere
What do you want to do?  (I/r/h) h
[root@linuxhelp Desktop]# ls
desktop          dir.zip
desktop.1        google-chrome-stable_current_amd64.deb
desktop.tar.bz2  google-chrome-stable_current_x86_64.rpm
deskzip.zip      home

Extraction of zip Archives

[root@linuxhelp Desktop]# dtrx deskzip.zip 
deskzip.zip contains one file but its name doesn' t match.
 Expected: deskzip
   Actual: desktop.tar.bz2
You can:
 * extract the file _I_nside a new directory named deskzip
 * extract the file and _R_ename it deskzip
 * extract the file _H_ere
What do you want to do?  (I/r/h) I
deskzip.zip contains 1 other archive file(s), out of 1 file(s) total.
You can:
 * _A_lways extract included archives during this session
 * extract included archives this _O_nce
 * choose _N_ot to extract included archives this once
 * ne_V_er extract included archives during this session
 * _L_ist included archives
What do you want to do?  (a/o/N/v/l) o
[root@linuxhelp Desktop]# ls
desktop          google-chrome-stable_current
desktop.1        google-chrome-stable_current_amd64.deb
desktop.tar.bz2  google-chrome-stable_current_x86_64
deskzip          google-chrome-stable_current_x86_64.rpm
deskzip.zip      home
dir.zip

Extraction of meta-data from .rpm and .deb files

Utilize the “ -m” option for this Extraction.

[root@linuxhelp Desktop]# dtrx -m google-chrome-stable_current_amd64.deb 
[root@linuxhelp Desktop]# dtrx -m google-chrome-stable_current_x86_64.rpm
[root@linuxhelp Desktop]# ls
desktop          google-chrome-stable_current
desktop.1        google-chrome-stable_current_amd64.deb
desktop.tar.bz2  google-chrome-stable_current_x86_64
deskzip          google-chrome-stable_current_x86_64.rpm
deskzip.zip      home
dir.zip


Execute the “ dtrx --help”

[root@linuxhelp Desktop]# dtrx --help
Usage: dtrx [options] archive [archive2 ...]

Intelligent archive extractor

Options:
  --version             show program' s version number and exit
  -h, --help            show this help message and exit
  -l, -t, --list, --table
                        list contents of archives on standard output
  -m, --metadata        extract metadata from a .deb/.gem
  -r, --recursive       extract archives contained in the ones listed
  --one=ONE_ENTRY_DEFAULT, --one-entry=ONE_ENTRY_DEFAULT
                        specify extraction policy for one-entry archives:
                        inside/rename/here
  -n, --noninteractive  don' t ask how to handle special cases
  -o, --overwrite       overwrite any existing target output
  -f, --flat, --no-directory
                        extract everything to the current directory
  -v, --verbose         be verbose/print debugging information
  -q, --quiet           suppress warning/error messages

To check the version of dtrx

[root@linuxhelp Desktop]# dtrx --version
dtrx version 7.1
Copyright ©  2006-2011 Brett Smith < brettcsmith@brettcsmith.org> 
Copyright ©  2008 Peter Kelemen < Peter.Kelemen@gmail.com> 

This program is free software  you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation  either version 3 of the License, or (at your
option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY  without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
Public License for more details.
Tag : DTRX
FAQ
Q
What is the dtrx tool?
A
The dtrx tool is an universal archive extractor for many archive types. dtrx stands for “Do The Right Extraction”. It is a free, open source archive extraction tool.
Q
What is -h command views?
A
For more details, look at the help section by running the following command:

$ dtrx -h
Usage: dtrx [options] archive [archive2 ...]

Intelligent archive extractor

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-l, -t, --list, --table
list contents of archives on standard output
-m, --metadata extract metadata from a .deb/.gem
-r, --recursive extract archives contained in the ones listed
--one=ONE_ENTRY_DEFAULT, --one-entry=ONE_ENTRY_DEFAULT
specify extraction policy for one-entry archives:
Q
What does the command ‘python setup.py install –prefix=/usr/local’ actually mean?
A
The command will install all binary files in /usr/local directory.
Q
is this alternative tool for TAR . Right ?
A
yes, it is . And also it is very simple than TAR
Q
is there any other option otherthan mentioned ?
A
no, those option's are only used