There are many command line tools on Linux to work with compressed files (more than one tool for some formats) and each tool has a different list of arguments. Not that I don’t remember how to extract a certain format, but sometimes all I need is quickly unpack a file and that’s it.

Once I have found a tiny shell script called ex that allowed to do that, I can’t remember now where exactly I got it, but after some search it seems that it’s made by a user rezza from Arch Linux forums. I was happy with that script for a while (or a few years), it worked well with most types of archives, but it was missing one important feature - it couldn’t extract into a certain directory.

Today I extended it or actually have completely rewritten. It became a bit bulky for a single .bashrc, but you can put the script file to e.g. your ~/.bin (make sure that it’s in $PATH) and use the same way as ex. You will also need to set the rights for execution:

$ chmod a+x ~/.bin/exx

I renamed mine to eXx (extended ex) for the people who still use the original script (and to eliminate any ambiguity). I had to exclude some formats like pure bzip2 and gzip, mainly because bunzip2 and gunzip don’t work with external directories. Anyways, nobody today uses those formats alone.

eXx supports .tar, tar.gz (.tgz), .tar.bz2 (.tbz2), tar.lzma (.tlz), 7z, zip and rar. It also checks if appropriate tools are installed, lets you know otherwise. Tested on Bash 3.2 at Ubuntu and may not work on BusyBox systems.

Some examples:

$ exx ~/*.{zip,7z} -C /tmp # extracts all *.zip and *.7z files from home dir to /tmp
$ exx file1.tar file2.tar.gz # extracts into the current directory

Download it from here: eXx