Unix/Linux tar - absolute path & relative path confusion

Unix:
tar tvf 001.tar shows:
-rw-rw-rw- 2123/1     3956 Mar 26 19:15 2010 /wdsfiles/boss/mailbox/outbox/001/con-cust.d

/tmp# tar xf 001.tar puts the file in:
/wdsfiles/boss/mailbox/outbox/001/con-cust.d

Linux:
tar tvf 001.tar shows:
-rw-rw-rw- 2123/1     3956 Mar 26 19:15 2010 /wdsfiles/boss/mailbox/outbox/001/con-cust.

/tmp# tar xf /wdsfiles/boss/mailbox/001.tar displays:
tar: Removing leading `/' from member names

and then puts the file in:
/tmp/wdsfiles/boss/mailbox/outbox/001/con-cust.d

First, why am I getting the "Removing leading `/' from member names" error when extracting the file in Linux?
Secondly, what is the command in Linux to extract the tar file into the absolute path of:
/tmp/wdsfiles/boss/mailbox/outbox/001/con-cust.d
shannon_adamsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SuperdaveCommented:
It's a safety thing, because somebody could make a tar archive that could overwrite any file on your system by using an absolute path name.  So GNU's tar changed the way it works.  Use tar xvPf to get the absolute path.
0
AmolCommented:
use this,

tar xvfP /tmp/wdsfiles/boss/mailbox/outbox/001/con-cust.d
0
shannon_adamsAuthor Commented:
tar xvfP  is what I was looking for, thanks.  However, I am confused about actually tarring files/directories in Linux vs. Solaris.

In Solaris, if you wanted to tar up a file(s), or a directory and store as an absolute path, you could do this:
tar cf - /tmp/sra/* > /tmp/test.tar

To extract contents of test.tar back into the same path (/tmp/sra):
tar xf /tmp/sra.tar

These commands will not work in Linux.  Can you provide the command to actually tar up the directory /tmp/sra and store in /tmp/test.tar using absolute pathes?  Therefore, when I use "tar xvPf /tmp/test.tar", it should extract the contents back into /tmp/sra.

Thanks.
0
SuperdaveCommented:
Use P in your options both ways. "tar cvPf /tmp/test.tar /tmp/sra" to create it, and "tar xvPf /tmp/test.tar" to extract it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shannon_adamsAuthor Commented:
Exactly what I needed!  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.