Hacker News new | ask | show | jobs
by glazskunrukitis 4916 days ago
I like those un- commands for easier archive extracting, e.g.:

alias unbz2='tar xvjf' alias untar='tar xvfz'

3 comments

I use atool (http://www.nongnu.org/atool/), which is packaged in Debian and Ubuntu (and I am sure in other distributions as well). It supports all the formats I have encountered so far (tar, tar.gz, zip, rar, bz2 and others).

It provides a few commands, two of which I use the most:

    als - list files in an archive
    aunpack - exatract files from an archive
The best part is aunpack extracts files into a subdirectory (I hate polluting the current directory with files from a new archive which wasn't properly packaged to include a directory), and it does it only when necessary. Before I found it, I always used to create a temp directory, cd to it, unpack into it, and possibly move files around etc.
Fortunately GNU tar has gotten smarter. You can do just "tar xvf" now and it will do the right thing whether the archive is compressed or not.

When creating the archive, you still have to use your favorite compression method (XZ aka LZMA, activated with J is even better, but slightly slower, than bzip).

I always use dtrx (do the right extraction). Check out its features:

http://brettcsmith.org/2007/dtrx/