Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-29-2007, 02:37 PM   #1
LQ Newbie
Registered: Sep 2004
Distribution: Libranet 2.81
Posts: 24

Rep: Reputation: 15
Is it possible to unpack a *.tar into a specific directory

When I unpack my *.tar files it recreates the directory in which the files were orginally stored. I need them to unpack in a different directory. I've tried the -C switch, but these doesn't seem to work -- I find the man page unclear, so perhaps I'm doing this wrong. Any suggestions?
Old 01-29-2007, 02:49 PM   #2
Registered: Nov 2004
Location: Novi Sad, Serbia
Distribution: Debian, Slackware, Gentoo, openSuSE
Posts: 254

Rep: Reputation: 31
Yeah, the -C switch will do it, but maybe you've used it wrong. Try this:

tar xf archive.tar -C /tmp
Old 01-29-2007, 03:00 PM   #3
LQ Newbie
Registered: Sep 2004
Distribution: Libranet 2.81
Posts: 24

Original Poster
Rep: Reputation: 15
Yeah, that's what I did. It still adds all the other subdirectories. E.g., if the files were originally in /home/bill/junk the the -C /tmp option puts them in /tmp/home/bill/junk -- what I want is for them to just be in /tmp. (I may well be asking tar to do something it cannot, and should not do!)
Old 01-29-2007, 06:04 PM   #4
Registered: Nov 2006
Location: Virginia
Distribution: OpenSuSE 10.2
Posts: 121

Rep: Reputation: 15
I think the point of TAR is to unroll it's tarballs the way they were rolled up. It usually being somewhat important that the tarball was created with the original diretories rolled into it. That said, I do think Gnome's "File Roller" utility does give the option of not recreating directories, so that all contents of the tarball spill out into the specified directory,


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.gz will not unpack werfer Linux - General 5 06-30-2006 06:42 PM
How To extract .tar.gz To A Specific Directory? George2 Linux - Software 4 02-18-2006 07:01 AM
how to unpack .tar? g-string 3 Debian 8 11-29-2004 08:01 AM
what do i do after i unpack the tar.gz sanjaya Linux - Software 1 02-11-2004 07:58 PM
tar gz files unpack attika Linux - General 1 08-06-2002 07:04 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:07 AM.

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