HPUX tar[1]



tar in anderen Kapiteln des hpux Handbuch: tar.4




 tar(1)                                                               tar(1)





 NAME
      tar - tape file archiver

 SYNOPSIS
      tar key [arg...] [file | -C directory] ...

 DESCRIPTION
      tar saves and restores archives of files on a magnetic tape, a
      flexible disk, or a regular file.  Its actions are controlled by the
      key argument.  key is a string of characters containing an optional
      version letter, exactly one function letter, and possibly one or more
      function modifiers.  The key string can be preceded by a hyphen (-)
      (as when specifying options in other HP-UX commands), but it is not
      necessary.

      Next, an additional arg argument is required for each of the function
      modifiers b or f used (see below).  If both b and f modifiers are
      specified, the order of the associated arg arguments must match the
      order of the modifiers.

      Each file argument specifies a file being saved or restored.  If file
      is a directory name, it refers to the files and (recursively)
      subdirectories contained in that directory.

      The version portion of the key determines in which format tar writes
      the archive.  tar can read either format regardless of the version.
      The version is specified by one of the following letters:

           N       Write a new (POSIX) format archive.  The new format
                   allows file names up to 256 characters in length, and
                   correctly archives and restores the following file types:
                   regular files, character and block special devices,
                   links, symbolic links, directories, and FIFO special
                   files.  The new version also stores the user and group
                   name of each file and attempts to use these names to
                   determine the uid and gid of a file when restoring with
                   the p function modifier.  This is the new default format.

           O       Write an old (pre-POSIX) format archive.

      The function portion of the key is specified by one of the following
      letters:

           c       Create a new archive; write from the beginning of the
                   archive instead of starting after the last file.  Any
                   previous information in the archive is overwritten.

           r       Add the named file to the end of the archive.

           t       List the names of all the files on the archive.  Adding
                   the v function modifier expands this listing to include



 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





                   the file modes and owner numbers.  The names of all files
                   are listed each time they occur on the tape.

           u       Add any named file to the archive if it is not already
                   present or has been modified since last written on that
                   archive.

           x       Extract the named file from the archive and restore it to
                   the system.  If a named file matches a directory whose
                   contents was written to the archive, this directory is
                   (recursively) extracted.  If a named file on tape does
                   not exist on the system, the file is created as follows:

                      o  The user, group, and other protections are restored
                         from the tape.

                      o  The modification time is restored from the tape
                         unless the m function modifier is specified.

                      o  The file owner (uid) and group owner (gid) are
                         normally that of the restoring process.

                      o  The set-user-ID, set-group-ID, and sticky bits are
                         not set automatically.  The o and p function
                         modifiers control the restoration of protection;
                         see below for more details.

                   If the files exist, their modes are not changed, but the
                   set-user-ID, set-group-ID and sticky bits are cleared.
                   If no file argument is given, the entire content of the
                   archive is extracted.  Note that if several files with
                   the same name are on the archive, the last one overwrites
                   all earlier ones.

      The following function modifiers can be used in addition to the
      function letters listed above (note that some modifiers are
      incompatible with some functions):

           A    Suppress warning messages that tar did not archive a file's
                access control list.  By default, tar writes a warning
                message for each file with optional ACL entries.

           b    Cause tar to use the next arg argument as the blocking
                factor for archive records.  The default is 20; the maximum
                is at least 20.  However, if the f - modifier is used to
                specify the standard input, the default blocking factor is
                1.

                Blocking factor is determined automatically when reading 9-
                track tapes (key letters x and t).  [On 9-track tapes, the
                physical tape record length is the same as the block size.



 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





                The block size is defined as the logical record size times
                the blocking factor (number of logical records per block).]
                The blocking factor must be specified when reading flexible
                disks and cartridge tapes if they were written with a
                blocking factor other than the default.

                If a tar file is read using a blocking factor not equal to
                the blocking used when the file was written, an error may
                occur at the end of the file but there may or may not be an
                actual error in the read.  To prevent this problem, a
                blocking factor of 1 can be used, although performance may
                be reduced somewhat.  tar writes logical records of 512
                bytes, independent of how logical records may be defined
                elsewhere by other programs (such as variable-length records
                (lines) within an ASCII text file).

           f    Cause tar to use the next arg argument as the name of the
                archive instead of /dev/rmt/0m.  If the name of the file is
                -, tar writes to the standard output or reads from the
                standard input, whichever is appropriate, and the default
                blocking factor becomes 1.  Thus, tar can be used as the
                head or tail of a pipeline.  tar can also be used to move
                hierarchies with the command:

                     cdfromdir; tar cf - . | (cd  todir ; tar xf -)

           h    Force tar to follow symbolic links as if they were normal
                files or directories.  Normally, tar does not follow
                symbolic links.

           H    Cause all entries in hidden directories (context-dependent
                files) to be written to the archive (see cdf(4)).  Normally,
                tar only writes the entry in the CDF that matches the
                context of the tar process.  See getcontext(2).  This
                modifier works only when writing archives.  When reading
                archives, tar automatically restores hidden directories if
                the archive was created with the H modifier.

           l    Tell tar to complain if it cannot resolve all of the links
                to the files being saved.  If l is not specified, no error
                messages are printed.

           m    Tell tar not to restore the modification time written on the
                archive.  The modification time of the file will be the time
                of extraction.

           o    Suppress writing certain directory information that older
                versions of tar cannot handle on input.  tar normally writes
                information specifying owners and modes of directories in
                the archive.  Earlier versions of tar, when encountering
                this information, give error messages of the form:



 Hewlett-Packard Company            - 3 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





                     name/: cannot create.

                This function modifier suppresses writing that information.

                When o is used for reading, it causes the extracted file to
                take on the user and group ID (uid and gid) of the user
                running the program rather than those of the tape.  This is
                the default for the ordinary user and can be overridden, to
                the extent that system protections allow, by using the p
                function modifier.

           p    Cause file to be restored to the original modes and
                ownerships written on the archive, if possible.  This is the
                default for the superuser, and can be overridden by the o
                function modifier.  If system protections prevent the
                ordinary user from executing chown(), the error is ignored,
                and the ownership is set to that of the restoring process
                (see chown(2)).  Set-user-ID, set-group-ID, and sticky bit
                information are restored as allowed by the protections
                defined by chmod() if the chown operation above succeeds.

           # d  Specify a particular tape drive and density where # is a
                tape drive number (0,...,7), and d is the density: (l = low
                (800 bpi), m = medium (1600 bpi), or h = high (6250 bpi)).
                This modifier selects the drive on which the nine-track tape
                is mounted.  The default is 0m.

           v    Normally, tar does its work silently.  The v (verbose)
                function modifier causes tar to type the name of each file
                it treats, preceded by the function letter.  With the t
                function, v gives more information about the tape entries
                than just the name.

           V    Same as the v function modifier except that when using the t
                option, tar also prints out a letter indicating the type of
                the archived file.

           w    Cause tar to print the action being taken, followed by the
                name of the file, then wait for the user's confirmation.  If
                the user answers y, the action is performed.  Any other
                input means ``no''.

      The following option can be included in the file list:

           -Cdirectory    tar performs a chdir() to directory (see
                          chdir(2)).  This allows multiple directories not
                          related by a close or common parent to be archived
                          using short relative path names.

      When end-of-tape is reached, tar prompts the user for a new special
      file and continues.



 Hewlett-Packard Company            - 4 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





      If a nine-track tape drive is used as the output device, it must be
      configured in Berkeley-compatibility mode (see mt(7)).

 EXTERNAL INFLUENCES
    Environment Variables
      LC_TIME determines the format and contents of date and time strings
      output when listing the contents of an archive with the -v option.

      LANG determines the language equivalent of y (for yes/no queries).

      If LC_TIME is not specified in the environment or is set to the empty
      string, the value of LANG is used as a default for each unspecified or
      empty variable.  If LANG is not specified or is set to the empty
      string, a default of "C" (see lang(5)) is used instead of LANG.  If
      any internationalization variable contains an invalid setting, tar
      behaves as if all internationalization variables are set to "C".  See
      environ(5).

    International Code Set Support
      Single- and multi-byte character code sets are supported.

 ERRORS
      tar complains about bad key characters and tape read/write errors.

      tar complains if not enough memory is available to hold the link
      tables.

 EXAMPLES
      Create a new archive on /dev/rfd.0 and copies file1 and file2 onto it,
      using the default blocking factor of 20.  The key is made up of one
      function letter (c) and two function modifiers (v, and f):

           tar cvf /dev/rfd.0 file1 file2

      Archive files from /usr/include and /etc:

           tar cv -C /usr/include -C /etc

 WARNINGS
      The default version has changed from O to N beginning with HP-UX
      Release 8.0.

      Due to internal limitations in the header structure, not all file
      names of fewer than 256 characters fit when using the N version key.
      If a file name does not fit, tar prints a message and does not archive
      the file.

      Link names are still limited to 100 characters when using the N
      version key.





 Hewlett-Packard Company            - 5 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





      There is no way to ask for the n-th occurrence of a file.

      Tape errors are handled ungracefully.

      The u function key can be slow.

      If the archive is on a flexible disk or cartridge tape, and if the
      blocking factor specified on output is not the default, the same
      blocking factor must be specified on input.  This is because the
      blocking factor is not explicitly stored on the archive.  Updating the
      archive without following this rule can destroy it.

      Some previous versions of tar have claimed to support selective
      listing of file names using the t function key with a list.  This
      appears to be an error in the documentation because the capability
      does not appear in the original source code.

      There is no way to restore an absolute path name to a relative
      position.

      tar always pads information written to an archive up to the next
      multiple of the block size.  Therefore, if you are creating a small
      archive and write out one block of information, tar reports that one
      block was written, but the actual size of the archive might be larger
      if the b function modifier is used.

      Note that tar c0m is not the same as tar cm0.

      Do not create archives on block special devices.  Attempting to do so
      can causes excessive wear, leading to premature drive hardware
      failure.

    Access Control Lists
      Access control list descriptions in this entry apply only to standard
      HP-UX operating systems.  If HP-UX BLS software has been installed,
      access control lists are handled differently.  Refer to HP-UX BLS
      documentation for information about access control lists in the HP-UX
      BLS environment.

 AUTHOR
      tar was developed by AT&T, the University of California, Berkeley, HP
      and POSIX.

 FILES
      /dev/rmt/*
      /dev/rfd.*
      /tmp/tar*

 DEPENDENCIES
    Series 700/800
      The -r and -u options are not supported on QIC devices.  If these



 Hewlett-Packard Company            - 6 -     HP-UX Release 9.0: August 1992






 tar(1)                                                               tar(1)





      options are used with QIC devices, tar fails and displays the message:

           tar: option not supported for QIC devices

 SEE ALSO
      ar(1), cpio(1), mt(7), getcontext(2), cdf(4), acl(5).

 STANDARDS CONFORMANCE
      tar: SVID2, XPG2, XPG3













































 Hewlett-Packard Company            - 7 -     HP-UX Release 9.0: August 1992