LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar and gzip - how do i point to a output directory (https://www.linuxquestions.org/questions/linux-newbie-8/tar-and-gzip-how-do-i-point-to-a-output-directory-29444/)

RedHat123 09-02-2002 06:50 PM

tar and gzip - how do i point to a output directory
 
I want to run tar with the xvzf options on a .tgz file - but is there any way to do this from some directory A and have the unzipped files be placed in another directory B ? Im too lazy to move the file then run tar :D

neo77777 09-02-2002 08:38 PM

How about consulting man page for tar?
Quote:

-C, --directory DIR
change to directory DIR

born4linux 09-03-2002 06:26 AM

let's say you have the tar file

/home/redhat123/package.tar.gz

and you want to extract it to

/tmp/source/

You can use this command to extract the contents of the tar file to /tmp/source:

tar -C /tmp/source -xzvf /home/redhat123/package.tar.gz

watch out for the spaces and syntax. If you want a GUI, you can ark (in RHL it is present, i dunno about other distros):

ark package.tar.gz

And you can just drag and drop to a directory.

brangnutux 09-04-2002 01:13 PM

cd to whatever directory you want the archive to be placed in. Then run your command pointing to the proper file. The archive will be untarred into the working (current) directory.

kevomac12 04-20-2011 10:48 AM

-C parameter for tar
 
If the archive doesn't support the -C you'll get... "File -C not present in the archive"! You won't be able to add an output local for the un-tar operation.


All times are GMT -5. The time now is 03:07 AM.