Bonus: it decompresses to a safely-named subdirectory, but moves the contents of that subdirectory back to the current directory if the archive contained exactly one file. Highly convenient without any risk of accidentally expanding 1000 files into the current directory.
After creating this macro, I've basically never had to care about how to decompress/unarchive anything.
# 'x' for 'eXpand'
alias xx='command atool -x'
# use
% cd $UNPACK_DIR # (optional) (can be the PARENT dir)
% xx foo.zip # or .tar.{gz,xz} or whatever
foo.zip: extracted to `foo' (multiple files in root)
% cd foo/
% ls | wc -l
3
atool actually has many other useful features, but it's worth it just for the extractor.About the only thing that a small would need to be updated at this point is support for a new compressor. (that 2012 release mainly added suppport for plzip)
How does atool deal with cases where there are two versions of the same extractor?
# ~/.atoolrc
path_zip /path/to/preferred/bin/zip
See atool(1) for details. http://linux.die.net/man/1/atoolAs far as I know, different zip formats are not auto-detected. However, it does (optionally) use file(1) to detect the file format, which can be overridden with the 'path_file' option, so a hack may be possible?