Using tar

I'm really annoyed here....

I'm a beginner on the HP-UX system, my expirience comes from the Linux OS. Here is a problem that really annoyes me...

I'm doing a:  tar cf /etc/passwd mytar.tar

When I'm untaring this with: tar xvf mytar.tar
then I extract the file with the absolute path !!!   Which I'm not used to from the GNU environment.

I want to extract my files relative... or more exact... I want to archive them without the absolute path   ( drop / )

Thanks.....
LVL 3
rogersk041399Asked:
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.

chris_calabreseCommented:
First, I assume you mean tar cf mytar.tar /etc/passwd, or you'll blow away your passwd file.

Also, the HP-UX behavior is the way every other Unix system I've ever seen works with tar, and I'd be very surprised if gnutar works like this by default.

Meanwhile, if you don't want absolute paths in your tar archive, try creating it like this:
  tar cf mytar.tar -C /etc passwd
or
  cd /etc && tar cf mytar.tar passwd

This even works for the whole system, as you can always do something like this:
  tar cf /dev/rmt/0m -c / .

If you need more control than this, try using the pax command instead (pax is a replacement for tar and cpio that is a lot more flexible than either).  Or, if you really like gnutar, you can get gnutar binaries for HP-UX from http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.16/
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
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.