extraction of directory and below using gnu tar

i need to restore everything in a certain directory and lower. I have a tgz archive of all of the files, and i need to restore everything in /user/home/xxxx/ and below. this is a users home directory. this is a dumb question and i know when i see the answer i am going to say DUH, but i am drawing a blank right now.

Assuming that tar stripped the leading slants when it created the archive, this should work:

cd /some/work/directory
gzip -dc file.tgz | tar -xf - user/home/xxxx

If your version of tar supports -z, then

tar -xzf file.tgz user/home/xxxx

I always restore into a working directory so as not to accidentally overlay something. Once the files are restored, you can copy/move them as needed.

1 Like

yes thank you , i was not leaving off the leading /, so it wasnt finding anything.,....