LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 10-23-2003, 02:47 PM   #1
bkeating
Member
 
Registered: Mar 2002
Location: San Francisco, CA
Distribution: Open/FreeBSD, Gentoo, SuSE
Posts: 511

Rep: Reputation: 30
tar - how to extact only a single file from a archive?


I have a gzipped archive (5gigs) and would like to extract only one file (in this case, rc.conf).

the man doesn't really explain the proper syntax to do this, can someone give me a hand?
 
Old 10-23-2003, 03:05 PM   #2
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
gzip -dc file.tar.gz | tar xf - pathname/filename

eg.
gzip -dc linux-2.4.22.tar.gz | tar xf - linux-2.4.22/README
 
Old 10-23-2003, 03:12 PM   #3
bkeating
Member
 
Registered: Mar 2002
Location: San Francisco, CA
Distribution: Open/FreeBSD, Gentoo, SuSE
Posts: 511

Original Poster
Rep: Reputation: 30
I believe (saw) an easier way, no pipes, just tar but this is what im having difficultly figuring out.
 
Old 10-23-2003, 04:42 PM   #4
bkeating
Member
 
Registered: Mar 2002
Location: San Francisco, CA
Distribution: Open/FreeBSD, Gentoo, SuSE
Posts: 511

Original Poster
Rep: Reputation: 30
I figured it out, pretty simple;

Code:
#tar -zxf backup.tar.gz /file/to/extract
another nice things is;

Code:
#tar -tf backup.tar.gz /file/to/extract
This lists the file(s) you'd like to extract (good safety percaution n such)
 
  


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
old tar? archive maenho Linux - Software 4 12-14-2006 08:05 PM
TAR Archive file - need relative path cmd0a0 Linux - Software 2 10-19-2005 03:57 PM
tar - extracting a single directory from a large archive? lowpro2k3 Linux - General 1 07-24-2005 03:44 AM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 01:35 AM
Problem creating tar.gz archive - File changed as we read it doctorwebbox Linux - General 1 02-04-2004 06:59 PM


All times are GMT -5. The time now is 04:14 AM.

Main Menu
Advertisement
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