e – Extract Any Archive


With this little tool you can extract almost any archive in Linux so you do not need to remember which tool and what command lines are necessary.


I got fed up with the sheer impossible number of compression formats out there. I am an avid linux command line user, but remembering 20 different commands with strange switches to get to the juicy content of a compressed files is too much for me.

Therefore I have just happily spent a few hours of my life to write the application e that identifies which extraction tool to call with what parameter in order to save me precious seconds of rereading forgotten manpages.


This marvelous extraction tool works like this:

  • Extract a zip file:

  • Extract a rar file:

  • Extract several archives, one after another:

  • Extract every file from the current directory:

If possible, e identifies the file format by the content and not by the extension, so for most filetypes e can extract it no matter how you name it. It supports rar, zip, tar.gz, tar.bz2, cab, ace, 7zip, dep, rpm, lha, lzop, rzip, and some more; it is very easy to extend it to support other compression utilities.

I was also inspired by the ugliness of the tool unp which tries to do exactly what e does. I did not like the implementation (written in Perl), and thought I can have the same features in a much simpler and more extensible way. The result is that e is just about 80 lines of code, where most of it is either comment or rules that define when to call what. If you know Ruby, have a look at the code.


For the impatient, installation on Ubuntu:

Step by step:

  1. e is written in Ruby, so you need to install this.
  2. Download e from here
  3. copy e into your /usr/local/bin directory
  4. make it executable with chmod +x /usr/local/bin/e.

If you find an archive that e cannot extract and you know a working rule for it, please tell me and I will integrate it.



Apart from Ruby, e uses the linux tool file to determine what kind of archive it is dealing with. This tool should be available on any proper Linux installation. Once e knows the archive type, the appropriate extraction tool is executed. You might need to install a missing tools if you do not have it already.


Here you can find the changes e has undergone over time.

25th June 2009
Command for NanoZip added.
Extracting RPM now preserves the original file timestamps (thanks to Michael Gruys)
14th January 2009
Support for PowerISO added.
When RAR extraction fails, broken files are not deleted any more.
24th February 2008
Support for FreeArc added, when the extension .arc is used.
8th January 2008
Added support for extraction of self-extracting zip, thanks for Samuel Jones for recognizing this. When e is called without parameters, it shows the release date and a copyright.
25th February 2007
When extracting multiple archives and extraction fails, e now continues to extract the other files and prints an error message about all the files when it has finished.
28th December 2006
In Ubuntu the 7z executable is now called 7zr. Now e works with the executables 7z, 7za, and 7zr.
10th December 2006
Added rules for ar, cpio, dar, uharc, and zzip. For uharc you need wine, and uharc.exe in your path.
14th August 2006
Added comments, fixed a typo
12th August 2006
ADD Extraction of debian packages with ar if dpkg is not available
ADD support for LZMA tar archives (extension has to be .tar.lzma or .tlz)
11th August 2006
First public release of e.


  1. damentz says:

    wow thx this is really useful, i dont know how many times ive resorted to taking the longer and buggier gui approach because i dont want to learn how to extract certain files through the terminal

  2. shevegen says:

    There is a way to extract .deb packages if you dont have dpkg installed (i.e. on non debian systems)

    ar -x name_of_deb_package.deb

    By the way, are there any other formats missing?

  3. martinus says:

    thanks shevegen, the new version of e now uses ar if dpkg fails or is not available.

    I am sure there are formats missing, but I do not think I have ever used any other format then the ones supported.

    Update: I have just added LZMA support :-)

  4. Aaron says:

    Looks nice, but it seems to be missing one feature from the script I currently use for this purpose:


    atool deals better (IMO) with archives that don’t have a containing directory. It does this by unpacking into a temporary directory. If once the extraction is complete it has only one child, that’s moved to the same directory as the archive. Otherwise, the temporary directory is given a name based on the archive file’s name.

    Besides extracting archives, it also includes programs to list archive contents, create new archives, compare 2 archive files (using diff).

    One drawback to atool as opposed to this script, is that atool uses archive file name to determine the type of archive rather than using the file command. Although this is what allows it to do archive creation.

  5. csabahenk says:

    Do you know of libarchive?


    It comes with the bsdtar utility which is an universal archiver. Its great advantage is that is has no external dependencies.

    e would make sense anyway as a ruby llibrary. It sounds to be useful to be able to access any archived content via an unified API. Possibly it’s already there, alltohugh the examples doesn’t reveal this use case.

  6. Anonymous says:

    I tried it on my Powerbook. I haven’t tested it vigorously, but it seems to work at a quick glimpse.

    So you could add “Mac OS X” in addition to Linux as the supported platforms :-)

  7. Mike says:

    Just dropping a big thanks for this extremely handy utility. Nothing else to say that hasn’t already been said above.

  8. christy donnelly says:

    hello martin.christy here.i got my first computer 6 months ago and almost immediately stumbled across linux.did not like windows!i have just begun to dabble in the terminal.what a headwreck!now,ive come across E.i have managed to get ruby into usr/bin but dont know how to get the script of E into it.any help would be really appreciated as E would take decades off my zip zap rar tar unrar nightmare. yours….christy.

  9. If you use ubuntu, you can try the installation routine that I have described above. If that does not work, you have to be a little bit more precise or I have no idea what your problem is!

  10. Sam Jones says:

    wonderful script. saved me a lot of trouble since I found it. Only problem I’ve seen is that it doesn’t always work for Windows-generated zip files.

    sjones[unzip]$ e kit.zip

    ERROR extraction not successful with these files:
    kit.zip: MS-DOS executable PE for MS Windows (GUI) Intel 80386 32-bit, ZIP self-extracting archive (WinZip)

    As far as I can tell, this file is just not recognized by contents, so I added this to the script:

    rules.push [ :name, /(\.zip)$/, “unzip %FILE%” ]

    Thanks again for the great tool :-)

  11. Carra says:

    Using Fedora 8 — works, but cosmetic bug: I’m extracting a .deb file and don’t have dpkg. e generates an error on dpkg then run ar and quietly finishes. From a new user look, it looks like things didn’t work when they actually did.

    Error was: sh: dpkg: command not found

    If there were some way to generate that error ONLY IF things didn’t work *at all*, that’d be nice. (No news is good news, right?) Maybe redirect all stdout/stderr to temp files, then print it if all system() calls fail? (Assuming that THEY all produce reasonable return codes, that is.)

    Also you might think of putting a version stamp in your script, or at least get ‘e –version’ to work.

    Nice script, even if it ISN’T perl. 😉

  12. hi carra, I have updated e with a litte version information when you dont specify any parameters. It also supports FreeArc now.
    As for any extensions, I consider e as feature complete, any modifications that go beyond adding other rules would have to be done by somebody else. So feel free to rewrite it in perl :-)

    Oh, and here is also another version of e that has more features: http://thoughtfolder.com/2008-02-01-the-script-i-use-every-day.html

  13. info_tech_guy says:

    /tmp$ /usr/local/bin/e hm_setup.exe

    ERROR extraction not successful with these files:
    hm_setup.exe: MS-DOS executable PE for MS Windows (GUI) Intel 80386 32-bit

  14. Dan says:

    This is a pretty awesome tool. I cannot count the number of times I’ve had to re-read the man pages for the various extraction utilities to get the switches right. I personally commend you and hope this makes it’s way in as a standard addition to most distributions (I currently use SuSE). Props to you Martin!

  15. Michael says:

    Hey Martin,
    I’m using Ubuntu 8.10 and followed your installation commands. I keep getting an error when trying to extract an arc archive.
    Error is “arc: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory”.
    Any thoughts on that?

  16. Erwin says:

    One problem, just installed Intrepid Ibex (ubuntu 8.10)
    After copying the exact code for the teriminal, you are asked if you want to continue y/n. If I say Y, it says abort. and doesn’t do anything afterwards.


  17. Michael says:

    Awesome tool!
    I have made one adjustment for extracting RPM files.

    I added the -m option to preserve the original ‘pack’ – date

    rules.push [ :type, /^RPM/, “rpm2cpio < %FILE% | cpio -i -m -d –verbose” ]

    THANKS for sharing this powerful utility

  18. John Murray says:

    Hey, I am a student at Northern Kentucky University and I wanted to use your script on a web crawler program for my research. I wanted to get your approval before using the script as it may be distributed later in the future. I will of course give you full credit for the use of your script. If you can send me an e-mail letting me know, that would be much appreciated! By the way, the script is very useful!

Leave a Reply

Your email address will not be published. Required fields are marked *