View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 09-28-2005, 01:21 PM   #1
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
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).

Old 09-28-2005, 01:43 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
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
Old 09-28-2005, 01:47 PM   #3
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
tar - extracting a single directory from a large archive? lowpro2k3 Linux - General 1 07-24-2005 02:44 AM
I can't open the tar ball and install the program Gins Linux - General 53 12-02-2004 01:50 PM
tar ball uninstall? Xris718 Linux - General 3 09-20-2004 08:55 PM
compiling a tar ball - needed help please... lpriyamb Linux - Software 3 10-10-2003 04:33 AM
Installing from tar ball problem linuxlah Linux - General 5 07-10-2002 06:31 AM

All times are GMT -5. The time now is 01:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration