Slackware This Forum is for the discussion of Slackware Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-05-2005, 06:52 AM
|
#1
|
|
Senior Member
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288
Rep:
|
using tar to extract properly
Hi all,
I'm trying to figure out how to untar to a specific destination, similar to how 'installpkg' copies everything to its required destination
Say i tar cvvf /var/www/htdocs htdocs.tar
and i'm in my home folder now...
If i untar the file
tar xvvf htdocs.tar
it will be extracted to my current directory
/home/xushi/var/www/htdocs
instead of being moved to its propper destination
/var/www/htdocs
How can i solve this problem?
|
|
|
|
03-05-2005, 06:57 AM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
if you're including the full file path inside the tar, you can extract the tar straight to the root directory, / which will implicitly put things in the right place.
Last edited by acid_kewpie; 03-05-2005 at 06:59 AM.
|
|
|
|
03-05-2005, 06:58 AM
|
#3
|
|
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,282
Rep:
|
Did you try the -P option (--absolute-paths) when extracting, like
tar xvfP htdocs.tar
|
|
|
|
03-05-2005, 06:59 AM
|
#4
|
|
Member
Registered: Jan 2005
Distribution: Slackware current (and others)
Posts: 188
Rep:
|
First of all, I think U mean
tar cf htdocs.tar /var/www/htdocs
and second , what U R locking for is
tar xzf htdocs.tar -C /
Hope this work
|
|
|
|
03-05-2005, 07:00 AM
|
#5
|
|
Senior Member
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288
Original Poster
Rep:
|
If i also want to bzip it, would i do it this way?
tar cfj htdocs.tar.bz2 /var/www/htdocs
tar xzfjP htdocs.tar.bz2 -C /
EDIT:
No keefaz, i didn't try the -P option. i will compare both now.
EDIT: added P
Last edited by xushi; 03-05-2005 at 07:04 AM.
|
|
|
|
03-05-2005, 07:03 AM
|
#6
|
|
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,282
Rep:
|
Try to put the option in this order (the f at least)
tar cjvf htdocs.tar.bz2 /var/www/htdocs
|
|
|
|
03-05-2005, 07:07 AM
|
#7
|
|
Senior Member
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288
Original Poster
Rep:
|
I keep getting this warning, i don't know if it affects anything i do or not
tar cjvf test.tar.bz2 /download/my.pls
tar: Removing leading '/' from member names
EDIT: This removal is the problem i'm facing.. I was wondering if there's anyway to disable that. So far, it works with the -C / option though.
Last edited by xushi; 03-05-2005 at 07:15 AM.
|
|
|
|
03-05-2005, 07:51 AM
|
#8
|
|
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,282
Rep:
|
I see, I would think the -P option can keep the leading '/' when taring
(I believed that this option was to be set during extracting but it seems rather
be used during taring)
|
|
|
|
03-05-2005, 08:31 AM
|
#9
|
|
Senior Member
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288
Original Poster
Rep:
|
Quote:
Originally posted by keefaz
I see, I would think the -P option can keep the leading '/' when taring
(I believed that this option was to be set during extracting but it seems rather
be used during taring)
|
From the testing i've just done.. Apparently you need to add the -P option on both tarring and untarring 
|
|
|
|
03-05-2005, 09:10 AM
|
#10
|
|
Member
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795
Rep:
|
Tar:
tar czpf <tarball name> <Files to be tarred>
Untar:
tar zxf <tarball name> -C <Location>
To do Bzip, replace 'z' with 'j'
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:33 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|