There are a few things you need before you can un-tar a file. First, you’ll need to have the file’s name. Next, you’ll need to have the appropriate software installed. Finally, you’ll need to be able to un-tar the file. To un-tar a file, open a command prompt and type: tar -xvf filename.tar


The traditional way of downloading and untarring something in the terminal would be something like this:

Or perhaps the more compact form:

tar xvzf latest.tar.gz

rm latest.tar.gz

Either way is a bit clumsy. This is a very simple operation, a powerful shell like bash should allow such a task to be performed in a more “slick” manner.

Well, thanks to a useful little command “curl”, we can actually accomplish the mess above in just one piped statement:

No temporary files to get rid of, no messing around with ampersands. In short, a highly compact, efficient command. In fact, from a theoretical standpoint, the curl method can be faster than the concatenated wget/tar/rm mess since stdout piping will use RAM as a buffer if possible, whereas wget and tar (with the -f switch) must read/write directly from a disk.

Incidentally, tar with the -v option (the way we’re using it in all the above examples) prints each file name to stdout as each is untarred. This can get in the way of curl’s nice, ncurses output showing download status. We can silence tar by invoking it without -v thusly:

And that’s all there is to it!