e - Extract Any Archive
What?
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.
Why?
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.
Usage
This marvelous extraction tool works like this:
- Extract a zip file:
e file.zip
- Extract a rar file:
e file.rar
- Extract several archives, one after another:
e a.tar.gz b.tar.bz2 c.cab d.deb e.rpm
- Extract every file from the current directory:
e *
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.
Installation
For the impatient, installation on Ubuntu:
sudo apt-get install ruby wget http://martin.ankerl.com/files/e chmod a+x e sudo mv e /usr/local/bin
Step by step:
- e is written in Ruby, so you need to install this.
- Download e from here
- copy e into your /usr/local/bin directory
- 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.
Download
- Get e here.
Requirements
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.
ChangeLog
Here you can find the changes e has undergone over time.
- 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.
27 Comments
Trackbacks
- redemption in a blog
- Programming Kung Fu » Program “e” updated
- “e” — New Release of Extract Any Archive — Martin Ankerl
- La otra bola de cristal » Blog Archive » Otra manera de descomprimir rápida y fácilmente
- Linux Music » Blog Archive » Descomprime Archivos De Forma Chupá En Linux Con E
- links for 2007-11-13 « Where Is All This Leading To?
- e:可以解包多种存档格式的小工具 | LinuxDig



August 12th, 2006 at 4:26 am
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
August 12th, 2006 at 12:48 pm
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?
August 12th, 2006 at 1:39 pm
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
August 14th, 2006 at 8:15 pm
You might want to change extrationSuccess to extractionSuccess.
August 14th, 2006 at 8:59 pm
thanx Will, I fixed that.
August 16th, 2006 at 11:43 pm
Looks nice, but it seems to be missing one feature from the script I currently use for this purpose:
http://www.nongnu.org/atool/
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.
August 17th, 2006 at 7:06 pm
Do you know of libarchive?
http://people.freebsd.org/~kientzle/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.
August 18th, 2006 at 10:42 am
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
March 25th, 2007 at 9:56 pm
Just dropping a big thanks for this extremely handy utility. Nothing else to say that hasn’t already been said above.
November 15th, 2007 at 9:14 pm
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.
November 15th, 2007 at 9:20 pm
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!
November 15th, 2007 at 10:22 pm
hello martin.thanks for your reply.im using elive ,debian.i just dont understand how to put E into usr/bin.sorry for bothering you.
November 15th, 2007 at 10:37 pm
move it to /usr/local/bin:
November 15th, 2007 at 10:54 pm
martin. you and E are a blessing.i may have a chance of staying with linux after all.thank you!
November 22nd, 2007 at 10:57 am
http://packages.debian.org/unstable/utils/unp
January 8th, 2008 at 8:11 pm
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)
sjones[unzip]$
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
January 8th, 2008 at 10:59 pm
Hi Sam, thanks for that! I have updated e and the changelog on this page.
February 23rd, 2008 at 9:45 pm
Thanks so much! Great tool!
February 24th, 2008 at 7:35 am
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.
February 24th, 2008 at 3:01 pm
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