Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 1999 18:51:42 +0000
From:      Mark Ovens <marko@uk.radan.com>
To:        "Marko's Work" <marko@websorcery.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: about tar
Message-ID:  <36A382BE.DEA818A0@uk.radan.com>
References:  <01be430e$656259a0$9d83b7d1@vidbox>

next in thread | previous in thread | raw e-mail | index | archive | help


Marko's Work wrote:
> 
> If I have a large tar file (ex/ backup.tgz), how would i go about
> extracting just one file from the archive (without extracting the path
> or anything else)??
> 

Just to confuse everyone, this is marko replying to marko:-)

tar will extract a file with any path it is stored with. However, you
can change where that path starts. Say your file is (using tar tvf)
usr/home/file. If you want to extract it to, say, /tmp use ``tar xf
<tarfile> -C /tmp usr/home/file'' (change the options as req'd, e.g. zxf
if its a gzip'd tar). This will extract the file to /tmp/usr/home/file,
it may not be exactly what you want, but at least it won't overwrite the
original.

Note, the manpage for tar shows the ``-C'' option comes _after_ the
filename(s) but I've found that doesn't work, you need the filename(s)
last.

HTH



> Thanks for your help...
> 
> marko@websorcery.com
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
  Trust the computer industry to shorten Year 2000 to Y2K. It
  was this thinking that caused the problem in the first place.

           My homepage http://www.users.globalnet.co.uk/~markov
Mark Ovens, CNC Apps Engineer,   |    mailto:marko@uk.radan.com
Radan Computational Ltd          |         http://www.radan.com
Bath, England. CAD/CAM solutions | FreeBSD - The Power To Serve
for the Sheetmetal Work industry.|       http://www.freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36A382BE.DEA818A0>