{"id":11353,"date":"2019-03-13T06:51:27","date_gmt":"2019-03-13T06:51:27","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11353"},"modified":"2019-03-13T06:51:27","modified_gmt":"2019-03-13T06:51:27","slug":"dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux\/","title":{"rendered":"Dtrx \u2013 An Intelligent Archive Extraction (tar, zip, cpio, rpm, deb, rar) Tool for Linux"},"content":{"rendered":"<p>All of us might have faced a situation at some point of time or the other while using Linux\u00a0<strong>tar.gz<\/strong>,\u00a0<strong>tar.bz2<\/strong>,\u00a0<strong>tbz<\/strong>commands. So many archive types, so many commands to remember\u2026 Well, not any-more, thanks to\u00a0<strong>dtrx<\/strong>\u00a0tool.<\/p>\n<div id=\"attachment_5284\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Install-Dtrx-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5284\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Install-Dtrx-in-Linux.png\" alt=\"Install Dtrx in Linux\" width=\"606\" height=\"435\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Dtrx Tool for Extract Tar files<\/p>\n<\/div>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/18-tar-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">18 Tar Commands to Create and Extract Archives in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/how-to-open-extract-and-create-rar-files-in-linux\/\" target=\"_blank\" rel=\"noopener\">How to Open, Extract and Create RAR Files in Linux<\/a><\/li>\n<\/ol>\n<h3>What is Dtrx?<\/h3>\n<p><strong>Dtrx<\/strong>\u00a0stands for \u201c<strong>Do The Right Extraction<\/strong>\u201c, it\u2019s an open source and very effective command-line application for *nix systems that simplify your job of archive extraction easier.<\/p>\n<p>The\u00a0<strong>dtrx<\/strong>\u00a0command is an replacement of \u201c<strong>tar -zxvf<\/strong>\u201d or \u201c<strong>tar -xjf<\/strong>\u201d commands and it provides a one single command to extract archives in a number of different formats including\u00a0<strong>tar<\/strong>,\u00a0<strong>zip<\/strong>,\u00a0<strong>rpm<\/strong>,\u00a0<strong>deb<\/strong>,\u00a0<strong>gem<\/strong>,\u00a0<strong>7z<\/strong>,\u00a0<strong>cpio<\/strong>,\u00a0<strong>rar<\/strong>\u00a0and many more. It can also used to decompress files compressed with\u00a0<strong>bzip2<\/strong>,\u00a0<strong>gzip<\/strong>\u00a0etc.<\/p>\n<p>By default,\u00a0<strong>dtrx<\/strong>\u00a0extract contents to a dedicated directory and also fixes permission issues (like\u00a0<strong>permission denied<\/strong>) faced by user while extracting content to ensure that the owner can read and write all those files.<\/p>\n<h3>Dtrx Features<\/h3>\n<ol>\n<li><strong>Handles many archive types<\/strong>: It provides only one simple command to extract tar, zip, rar, gz, bz2, xz, rpm, deb, gem, self-extracting zip files and many other formats of exe files.<\/li>\n<li><strong>Keeps everything organized<\/strong>: It will extract archives into their own dedicated directories.<\/li>\n<li><strong>Sane permissions<\/strong>: It also make sure, user can read and write all those files after extraction, keeping permission intact.<\/li>\n<li><strong>Recursive extraction<\/strong>: It can find archives inside the archive and extract those too.<\/li>\n<\/ol>\n<h3>How to Install Dtrx in Linux<\/h3>\n<p>The dtrx tool is by default included in\u00a0<strong>Ubuntu<\/strong>\u00a0repositories, all you\u2019ve to do is simple do a\u00a0<strong>apt-get<\/strong>\u00a0to install in on your system.<\/p>\n<h4>On Debian\/Ubuntu\/Linux Mint<\/h4>\n<pre>$ sudo apt-get install dtrx<\/pre>\n<h4>On RHEL\/CentOS\/Fedora<\/h4>\n<p>On Red Hat based systems,\u00a0<strong>dtrx<\/strong>\u00a0is not available via default repositories, you need to download a dtrx script and install the program system-wide using below commands as\u00a0<strong>root<\/strong>\u00a0user.<\/p>\n<pre># wget http:\/\/brettcsmith.org\/2007\/dtrx\/dtrx-7.1.tar.gz\r\n# tar -xvf dtrx-7.1.tar.gz \r\n# cd dtrx-7.1\r\n# python setup.py install --prefix=\/usr\/local<\/pre>\n<h5>Sample Output<\/h5>\n<pre>running install\r\nrunning build\r\nrunning build_scripts\r\ncreating build\r\ncreating build\/scripts-2.6\r\ncopying and adjusting scripts\/dtrx -&gt; build\/scripts-2.6\r\nchanging mode of build\/scripts-2.6\/dtrx from 644 to 755\r\nrunning install_scripts\r\ncopying build\/scripts-2.6\/dtrx -&gt; \/usr\/local\/bin\r\nchanging mode of \/usr\/local\/bin\/dtrx to 755\r\nrunning install_egg_info\r\nCreating \/usr\/local\/lib\/python2.6\/site-packages\/\r\nWriting \/usr\/local\/lib\/python2.6\/site-packages\/dtrx-7.1-py2.6.egg-info<\/pre>\n<h3>How to Use dtrx Command<\/h3>\n<p>The dtrx command is sort of like the one ring to rule them all in the\u00a0<strong>Lord of The Rings<\/strong>. Instead of having to remember syntax for each archive, all you have to remember is dtrx command.<\/p>\n<h4>1. Extracting Single Archive<\/h4>\n<p>For example, I want to extract a archive file called \u201c<strong>tecmint27-12-2013.gz<\/strong>\u201c, I only execute dtrx command without using any flags.<\/p>\n<pre>[root@tecmint]# dtrx tecmint27-12-2013.gz<\/pre>\n<p>Other than simplifying the extraction, it has a bunch of other options like extracting the file to a folder and recursively extracting all other archives inside a given archive.<\/p>\n<h4>2. Extracting Multiple Archives<\/h4>\n<p>Consider you\u2019ve a file \u201c<strong>dtrAll.zip<\/strong>\u201c, consisting of\u00a0<strong>dtr1.zip<\/strong>,\u00a0<strong>dtr2.zip<\/strong>\u00a0and\u00a0<strong>dtr3.zip<\/strong>\u00a0each consisting of\u00a0<strong>dtr1<\/strong>,<strong>dtr2<\/strong>\u00a0and\u00a0<strong>dtr3<\/strong>\u00a0respectively. Instead of having to manually first extract the\u00a0<strong>dtrAll zip<\/strong>\u00a0and then extracting each one of the<strong>dtr1<\/strong>,\u00a0<strong>dtr2<\/strong>\u00a0and\u00a0<strong>dtr3<\/strong>\u00a0you can directly extract it in respective folders by using dtrx and by selecting option \u201c<strong>a<\/strong>\u201c, it extracts all the zip files recursively.<\/p>\n<pre>[root@tecmint]# dtrx dtrAll.zip<\/pre>\n<h5>Sample Output<\/h5>\n<pre>dtrx: WARNING: extracting \/root\/dtrAll.zip to dtrAll.1\r\ndtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.\r\nYou can:\r\n * _A_lways extract included archives during this session\r\n * extract included archives this _O_nce\r\n * choose _N_ot to extract included archives this once\r\n * ne_V_er extract included archives during this session\r\n * _L_ist included archives\r\nWhat do you want to do?  (a\/o\/N\/v\/l) <strong>a<\/strong><\/pre>\n<p>After, extraction, the contents of the extracted directory can be verified using\u00a0<a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>.<\/p>\n<pre>[root@tecmint]# cd dtrAll\r\n[root@tecmint]# ls \r\n\r\ndtr1  <strong>dtr1.zip<\/strong>  dtr2  <strong>dtr2.zip<\/strong>  dtr3  <strong>dtr3.zip<\/strong><\/pre>\n<h4>3. Extracting Specific Archive<\/h4>\n<p>Let\u2019s say you want to extract the first archive and not archives inside it. By selecting\u00a0<strong>N<\/strong>, it only extracts the given archive and not other archives inside it.<\/p>\n<pre>[root@tecmint]# dtrx dtrAll.zip<\/pre>\n<h5>Sample Output<\/h5>\n<pre>dtrx: WARNING: extracting \/root\/dtrAll.zip to dtrAll.1\r\ndtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.\r\nYou can:\r\n * _A_lways extract included archives during this session\r\n * extract included archives this _O_nce\r\n * choose _N_ot to extract included archives this once\r\n * ne_V_er extract included archives during this session\r\n * _L_ist included archives\r\nWhat do you want to do?  (a\/o\/N\/v\/l) <strong>N<\/strong><\/pre>\n<p>The contents of extracted directory can be verified using ls command as shown.<\/p>\n<pre>[root@tecmint]# cd dtrAll\r\n[root@tecmint]# ls\r\n\r\n<strong>dtr1.zip<\/strong> <strong>dtr2.zip<\/strong> <strong>dtr3.zip<\/strong><\/pre>\n<h4>4. Extract Each Layer of Archive<\/h4>\n<p>To extract each layer of archive inside archive on a case by case basis i.e., if you want to extract 2nd layer of archives but not the 3rd layer, you can use the \u201c<strong>o<\/strong>\u201d option.<\/p>\n<p>Consider you\u2019ve a zip file \u201c<strong>dtrNewAll.zip<\/strong>\u201c, which has \u201c<strong>dtrAll.zip<\/strong>\u201d and \u201c<strong>dtrNew<\/strong>\u201d as it\u2019s contents. Now if you want to extract the contents of \u201c<strong>dtrNewAll<\/strong>\u201d and \u201c<strong>dtrAll<\/strong>\u201d as well but not of\u00a0<strong>dtr1.zip<\/strong>,\u00a0<strong>dtr2.zip<\/strong>\u00a0and\u00a0<strong>dtr3.zip<\/strong>, you can use \u201c<strong>o<\/strong>\u201d and \u201c<strong>n<\/strong>\u201d options as shown below.<\/p>\n<pre># dtrx dtrNewAll.zip<\/pre>\n<h5>Sample Output<\/h5>\n<pre>dtrNewAll.zip contains 1 other archive file(s), out of 2 file(s) total.\r\nYou can:\r\n * _A_lways extract included archives during this session\r\n * extract included archives this _O_nce\r\n * choose _N_ot to extract included archives this once\r\n * ne_V_er extract included archives during this session\r\n * _L_ist included archives\r\nWhat do you want to do?  (a\/o\/N\/v\/l) <strong>o<\/strong><\/pre>\n<pre>dtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.\r\nYou can:\r\n * _A_lways extract included archives during this session\r\n * extract included archives this _O_nce\r\n * choose _N_ot to extract included archives this once\r\n * ne_V_er extract included archives during this session\r\n * _L_ist included archives\r\nWhat do you want to do?  (a\/o\/N\/v\/l) <strong>n<\/strong><\/pre>\n<p>The contents of extracted directory can be verified using\u00a0<strong>ls<\/strong>\u00a0command as shown.<\/p>\n<pre>[root@tecmint]# cd dtrNewAll\r\n[root@tecmint]# ls\r\n\r\ndtrAll  <strong>dtrAll.zip<\/strong>  dtrNew<\/pre>\n<pre>[root@tecmint]# cd dtrAll\r\n[root@tecmint]# ls\r\n\r\n<strong>dtr1.zip<\/strong> <strong>dtr2.zip<\/strong> <strong>dtr3.zip<\/strong><\/pre>\n<p>We first select the \u201c<strong>o<\/strong>\u201d option which means that all archives inside\u00a0<strong>dtrNewAll<\/strong>\u00a0will be extracted. Later we select the \u201c<strong>n<\/strong>\u201d option for\u00a0<strong>dtrAll.zip<\/strong>\u00a0which means that the archives inside it\u00a0<strong>dtr1.zip<\/strong>\u00a0,\u00a0<strong>dtr2.zip<\/strong>\u00a0and\u00a0<strong>dtr3.zip<\/strong>\u00a0will not be extracted.<\/p>\n<h4>5. Extract meta-data from .deb, .rpm and .gem files<\/h4>\n<p>The \u201c<strong>-m<\/strong>\u201d option extract the meta-data from\u00a0<strong>.deb<\/strong>,\u00a0<strong>.rpm<\/strong>\u00a0and\u00a0<strong>.gem<\/strong>\u00a0archives, instead of their normal contents. Here is an example of the command.<\/p>\n<pre>[root@tecmint]# dtrx -m openfire_3.8.2_all.deb \r\n[root@tecmint]# dtrx -m openfire-3.8.2-1.i386.rpm<\/pre>\n<pre>[root@tecmint]# ls\r\n\r\nconffiles  control  md5sums  postinst  postrm  prerm<\/pre>\n<p>There are lot more dtrx options to explore, just run the \u201c<strong>dtrx \u2013help\u201d<\/strong>\u00a0to list the available options.<\/p>\n<pre>[root@tecmint]# dtrx  --help\r\n\r\nUsage: dtrx [options] archive [archive2 ...]\r\n\r\nIntelligent archive extractor\r\n\r\nOptions:\r\n  --version             \tshow program's version number and exit\r\n  -h, --help            \tshow this help message and exit\r\n  -l, -t, --list, --table      \tlist contents of archives on standard output\r\n  -m, --metadata        \textract metadata from a .deb\/.gem\r\n  -r, --recursive       \textract archives contained in the ones listed\r\n  -n, --noninteractive  \tdon't ask how to handle special cases\r\n  -o, --overwrite       \toverwrite any existing target output\r\n  -f, --flat, --no-directory    extract everything to the current directory\r\n  -v, --verbose         \tbe verbose\/print debugging information\r\n  -q, --quiet           \tsuppress warning\/error messages<\/pre>\n<h3>Reference Links<\/h3>\n<p><a href=\"http:\/\/brettcsmith.org\/2007\/dtrx\/\" target=\"_blank\" rel=\"nofollow noopener\">dtrx Homepage<\/a><\/p>\n<p>I think you must give a try to\u00a0<strong>dtrx<\/strong>, because it\u2019s the only powerful command line tool that gives a single command to decompress any format of archive files.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>All of us might have faced a situation at some point of time or the other while using Linux\u00a0tar.gz,\u00a0tar.bz2,\u00a0tbzcommands. So many archive types, so many commands to remember\u2026 Well, not any-more, thanks to\u00a0dtrx\u00a0tool. Dtrx Tool for Extract Tar files 18 Tar Commands to Create and Extract Archives in Linux How to Open, Extract and Create &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Dtrx \u2013 An Intelligent Archive Extraction (tar, zip, cpio, rpm, deb, rar) Tool for Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11353","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11353"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11353\/revisions"}],"predecessor-version":[{"id":11355,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11353\/revisions\/11355"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}