Scheduled maintenance — back soon.

~/blog/download-and-untar-on-the-fly

Download and untar on the fly

Many times I download an archive, extract it somewhere then remove the archive file from the disk (it's just garbage). I have wondered if it's possible to do download and untar on the fly, by one command only:


wget -O - http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.3.tar.bz2|tar -xjf -

So what I did was to download the tar.bz2 archive (wget) to the stdout file (-O -) and then, by using the Linux pipe (|), I've redirected the standard output and I've used it like an input (-) for the tar command.

Comments

No comments yet

Be the first to leave a comment.

Leave a comment

Name and email required · moderated before publish · plain text only