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/
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).
You should be able to use either:
tar -xjf /path/to/image.tar.bz2
tar -C /tmp/test -xjf /path/to/image.tar.bz2
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 07:10 PM.|