How do you extract an archive using the shell?

Quick! How do you extract an archive using the shell?

Most of the time, you just want to extract everything to a new directory and then explore.

Unless you’re crusty, remembering how involves a man page, a sigh, and a Google search.

Screw that. If you’re on Debian, just install unp.

unp is a Perl script that makes extraction just work. None of that alphabet soup nonsense from tar!

Install it like this:

iain@turing:~$ sudo apt-get install unp
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
bzip2 unrar unrar-free xdms p7zip p7zip-full cabextract orange
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 20 not upgraded.
Need to get 0 B/13.6 kB of archives.
After this operation, 102 kB of additional disk space will be used.
Selecting previously deselected package unp.
(Reading database ... 22070 files and directories currently installed.)
Unpacking unp (from .../archives/unp_2.0~pre4_all.deb) ...
Processing triggers for man-db ...
Setting up unp (2.0~pre4) ...

Use it like this to extract the neo4j archive you downloaded earlier:

root@turing:/home/iain# unp neo4j-community-1.9.1-unix.tar.gz

I’ve truncated the output here to just the first and last line because this particular archive contains several hundred files.

But it’s as simple as that!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s