[Webinar] Streamline your web hosting managementRegister Today


Using tar

Posted on 2000-01-03
Medium Priority
Last Modified: 2013-12-06
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 / )

Question by:rogersk041399
1 Comment
LVL 14

Accepted Solution

chris_calabrese earned 200 total points
ID: 2320381
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
  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/

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question