Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-02-2002, 07:50 PM   #1
Registered: Dec 2001
Posts: 60

Rep: Reputation: 15
Question 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
Old 09-02-2002, 09:38 PM   #2
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
How about consulting man page for tar?
-C, --directory DIR
change to directory DIR
Old 09-03-2002, 07:26 AM   #3
Senior Member
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
let's say you have the tar file


and you want to extract it to


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.
Old 09-04-2002, 02:13 PM   #4
LQ Newbie
Registered: Jul 2002
Location: DC
Distribution: Mandrake 8.1
Posts: 11

Rep: Reputation: 0
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.
Old 04-20-2011, 11:48 AM   #5
LQ Newbie
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
Angry -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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to untar and unzip .tar.gzip.part file? linuxharsha Linux - Software 2 02-14-2004 11:37 AM
tar and gzip c0c0deuz Linux - General 2 10-31-2002 04:04 PM
gzip-1.2.4.tar Install ljc Linux - General 3 01-20-2002 10:44 PM
dd, tar and gzip nabil Linux - General 3 01-18-2002 05:51 PM
Need Serious Help With Tar And Gzip!! Please! rootlinux Linux - General 2 12-16-2001 02:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration