Extract file from tar home/

Mike McCarty Mike.McCarty at sbcglobal.net
Mon Jun 7 23:10:59 UTC 2010


Bob Goodwin wrote:
>     I have /home/bobg/ tar'd to "bobg.tar.gz." Can I extract individual
>     files or directories without unzipping the entire 17 gigs?

It depends on how you created the archive, and what you mean
by "unzipping the entire". The usual way to do this with
tar is either to use one of the compress switches, or (what
accomplishes the same thing) to pipe the output of tar through
gzip.

You can extract using

$ tar xzf bobg.tar.gz file-to-extract [...]

This does not create a 17 gig tar file on disc, which then gets
a file extracted from it. It pipes things. However, as much of
the file as is necessary to find the contained file does get passed both
through gunzip and through tar via a pipe. After the file you
want is extracted, you can abort with a ^C or etc.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I speak only for myself, and I am unanimous in that!


More information about the users mailing list