Friday, May 18, 2007

Extract the Contents of a Compressed Tar File

A colleague of mine asked about extracting the contents of a compressed tarball into a particular directory. I suggested downloading the tarball into the /tmp directory. It was a fairly large tarball consisting of several hundred megabytes. Here's an example of what was done.

#cd /tmp
#zcat compressed_tarball.Z | (cd /export/opt; tar xvfp -)

3 comments:

Mihai said...

you can also use -C destination_folder option to tar. It's more efficient especially if the file is large because it doesn't have to pipe

Mihai said...

tar xvpf your_Tarball.Z -C /export/opt

esofthub said...

mihai,

Thanks for sharing that tip with this community blog.