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!


How do you download Neo4j using the shell?

The Neo4j Server Installation documentation has minimal advice:

Download the latest release from
select the appropriate version for your platform

The website offers this download link for the current stable version of Neo4j on Linux:

This works fine in a web browser but not in my shell.

I used wget to fetch the package using that link:

root@turing:/home/iain# wget
[1] 14951
[2] 14952
root@turing:/home/iain# --2013-07-04 17:07:12--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-07-04 17:07:13 ERROR 404: Not Found.
[1]- Exit 8 wget
[2]+ Done version=1.9.1

After reporting a 404 error, wget hangs until I kill it with CTRL + C.

A website called Geil Things has a Neo4j wiki article that contains the real download link.

The link is hidden in a shell script. The important line looks like this:


If you replace ${NEWVERSION} with 1.9.1 you get the link the current stable version of Neo4j.

The complete wget command looks like this:


If you run the command in the shell you should see output like this:

root@turing:/home/iain# wget
--2013-07-04 17:21:52--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 37512748 (36M) [application/x-tar]
Saving to: “neo4j-community-1.9.1-unix.tar.gz”
100%[======================================>] 37,512,748 30.5M/s in 1.2s
2013-07-04 17:21:53 (30.5 MB/s) - “neo4j-community-1.9.1-unix.tar.gz” saved [37512748/37512748]

Now you’ve downloaded the archive. You can continue to follow the installation instructions in the documentation.