LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar - how to extact only a single file from a archive? (https://www.linuxquestions.org/questions/linux-newbie-8/tar-how-to-extact-only-a-single-file-from-a-archive-107674/)

bkeating 10-23-2003 01:47 PM

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?

Demonbane 10-23-2003 02:05 PM

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

bkeating 10-23-2003 02:12 PM

I believe (saw) an easier way, no pipes, just tar but this is what im having difficultly figuring out.

bkeating 10-23-2003 03:42 PM

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)


All times are GMT -5. The time now is 06:47 AM.