In order to extract a specific file from gzip compressed archive tarball you first need to know the full path to this file. Consider a following example.
$ tar tzf to-gzip.tar.gz
to-gzip/
to-gzip/file10.txt
to-gzip/file9.txt
to-gzip/file8.txt
to-gzip/file7.txt
to-gzip/file6.txt
to-gzip/file5.txt
to-gzip/file4.txt
to-gzip/file3.txt
to-gzip/file2.txt
to-gzip/file1.txt

In the above example we have used t command to list all files contained by to-gzip.tar.gz gzip archive. The output as a full path to all files in this archive. Next, we can use this path to extract any file. For example let's extract file2.txt from this archive:
$ tar xvzf to-gzip.tar.gz to-gzip/file2.txt
to-gzip/file2.txt
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions