-   Debian (
-   -   Extracting a tar ball directly into a directory (

kushalkoolwal 09-28-2005 02:21 PM

Extracting a tar ball directly into a directory
Ih, I have a very silly question but I admit that I am not able to do that. Here it is
I have image.tar.bz2 file in my home directory which I want to extract into /tmp/test/ directory. And this is how I am approaching right now:
1.cp image.tar.bz2 /tmp/test/ /tmp/test/
3. tar -xjf image.tar.bz2
4. rm image.tar.bz2

Now what I would like is to extract the files directly into /tmp/test directory from the directory where image.tar.bz2 files resides(in this case it is my home directory) without first copying the tar ball(step1) and then removing the tar ball(step 4).


david_ross 09-28-2005 02:43 PM

You should be able to use either:
cd /tmp/test
tar -xjf /path/to/image.tar.bz2

tar -C /tmp/test -xjf /path/to/image.tar.bz2

kushalkoolwal 09-28-2005 02:47 PM

Yes that works. Actually just before reading your post I read the man page for tar carefully and I found the -C option. Thank for looking inot this.


All times are GMT -5. The time now is 05:04 PM.