LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-11-2008, 12:54 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Rep: Reputation: 30
Extract specific directory / file from tar


I have a tar zip file that compressed by tar -zcvf , there are many directory and files in it , if I want to extract a specific directory or file from it ( not extract all files) , can advise what can i do ? thx
 
Old 09-11-2008, 01:01 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You can specify filenames or directories after using -x for extract, e.g.

tar -x foo/ foo -vf foobar.tar

will extract the file foo and the directory foo/ from foobar.tar.
 
Old 09-11-2008, 01:13 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Nylex View Post
You can specify filenames or directories after using -x for extract, e.g.

tar -x foo/ foo -vf foobar.tar

will extract the file foo and the directory foo/ from foobar.tar.
thx ,
it works , but if I want the files output to a specific path , but the original path , what can i do ? thx
 
Old 09-11-2008, 01:15 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I believe -C does what you want. Perhaps you should read the tar man and info pages?
 
  


Reply


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 - extract to different directory hcclnoodles Linux - Newbie 4 03-05-2011 03:47 PM
tar extract specific directory lrt Linux - Software 7 12-01-2007 08:40 AM
How to extract specific directory from a TAR file? Micro420 Linux - General 4 04-18-2007 12:04 AM
tar: how to extract only one directory from a backup guarriman Linux - General 1 01-29-2007 10:35 AM
How To extract .tar.gz To A Specific Directory? George2 Linux - Software 4 02-18-2006 07:01 AM


All times are GMT -5. The time now is 11:00 AM.

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