unp – Unpack (almost) everything with one command

Sponsored Link
unp is a small perl script which makes extraction of any archive files a bit easier. It support several compressors and archiver programs, chooses the right one(s) automatically and extracts one or more files in one go.

You may also want to install some non-free packages like "unace-nonfree", "unrar-nonfree" and "lha" to extract archives of these types.

Install unp in ubuntu

sudo apt-get install unp

Using unp

Unp Examples

unpack all archives in a directory

unp *.*

unpack, for example, all .rar archives in a directory

unp *.rar

unpack 1 archive

unp archivefile

unpack several archives at the same time

unp archivefile1 archivefile 2

Some more examples

unp *.tar.gz

unp *.tar.bz

unp *.rpm

unp *.deb

unp *.zip

unp *.rar

Known Problem

It doesn't extract files from RAR archives with full path

unp man page

NAME

unp – a shell frontend for uncompressing/unpacking tools

SYNOPSIS

unp [-u] file [ files ... ] [ --- backend args ... ] ucat file [ files ... ]

unp is a small script with only one goal: Extract as many archives as possible, of any
kind and from any path to the current directory, preserving the subdirectory structure
where needed. Is a Do-What-I-Want utility and helps managing several extraction programs without looking for needed options for the particular tool or worrying about
the installation of the needed program.

Run unp without arguments to see the list of supported archive formats.

The special version ucat acts as wrapper for commands that can output the extracted
data to standard output, like bzip (bzcat), gzip (zcat), tar,zip and others.

USAGE

unp extract one or more files given as arguments on the command line. Additionaly, it may pass some options to the backend tools (like taroptions) when they are appended after `–´.

There is also a special option (-u) which is very usefull for extracting of Debian packages. Using -u, unp extracts the package (i.e. the ar archive) first, then extracts data.tar.gz in the current directory and then control.tar.gz in control//.

NOTES

unp will try to decompress into a FILE.unp if it get trouble with existing files. But don’t count on this feature, always look for free working space before using unp.

In contrary to gunzip which decompresses the file in the target directory of the source file,unp will use current directory for output.

Sponsored Link

You may also like...

6 Responses

  1. steve123 says:

    “e” is MUCH better then unp try it out:

    http://fail2care.com/e-extract-any-archive

  2. Zap says:

    hm. seems to me that both tools are quite similar.
    but with using “e” i have to install ruby.
    why should i do this, when unp(perl based) works out of the box?

  3. steve123 says:

    unp is a package whereas e isn’t it’s just a script and yes you need to install ruby but it’s still only 1 package you need to install and also e is easier to to remember and quicker to type

    also for multiple file in a folder here is an example

    e *

    vs

    unp *.*

  4. Matthew says:

    Why not:

    for f in *;do case “$(echo $f|sed “s/.*\.\([a-z\.]*\)/\1/g”)” in zip)unzip -qqo $f&&rm $f;;tar.gz|tar.bz2)tar xf $f&&rm $f;;tar.bz2)tar yxf $f&&rm $f;;rar)unrar e -o+ -r -y $f&&rm $f;;7z)7z e -qqo $f;;esac;done

    ?

  5. steve123 says:

    that only unrar’s every file and is very long e is just a simple command 😉

  6. Arnaud Diederen says:

    “e” doesn’t seem to have an option similar to “unp”‘s ‘smart’ mode (-U), which will avoid carelessly-created archives from polluting your current working directory:

    $ unp -h
    […]
    -u Special helper mode.
    For most archive types:
    – create directory /
    – extract contents there
    For Debian/Ubuntu packages:
    – extract data.tar.gz after each operation in local directory
    – extract control.tar.gz into control//
    -U Smart mode, acts like -u (see above) if archive contains multiple
    elements but if there is only one file/directory element then it’s stored
    in the current directory.
    […]

    Also:
    alias e=unp

    There.
    No ruby.

Leave a Reply

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