Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tar(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought



TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



-------------------------------------------------------------------------------
tar



PURPOSE

Manipulates archives.

SYNTAX

       one of
       +----+  +------ -b20 ------+  +-----------------+
tar ---| -c |--| +--------------+ |--|     one of      |--->
       | -r |  +-| -v -w -d -h  |-+  | +-------------+ |
       | -t |   ^| -m -l -i     ||   +-| -f file     |-+
       | -u |   || -b blocks    ||     | -f file-num |
       | -x |   || - num        ||     +-------------+
       +----+   || -L inputlist ||
                || -N blocks    ||
                || -s -I        ||
                || -o           ||
                || -p           ||
                || -B           ||
                || -F           ||
                |+--------------+|
                +----------------+


                            +-----------------------+  +------------------+
                        >---|        one of         |--| +--------------+ |---|
                            | +-------------------+ |  +-| file         |-+
                            +-| -S blocksb        |-+   ^| directory    ||
                              | -S feet           |     || -C directory ||
                              | -S feet @ density |     |+--------------+|
                              +-------------------+     +----------------+

DESCRIPTION

The tar command writes files to or retrieves files from an archival storage
medium.  The tar command looks for archives on the default device (usually
tape), unless you specify another device with the -f flag.  File names must not
be longer than 100 characters and must not contain blanks.  Characters
following the first blank are ignored.

Pathname/filename combinations must not be longer than 256 characters.  No
single directory component may be longer than 155 characters.

When writing to an archive, tar uses a temporary file (/tmp/tar*) and maintains
in memory a table of files with several links.  You receive an error message if
tar cannot create the temporary file, or if there is not enough memory
available to hold the link tables.



Processed November 8, 1990         TAR(1,C)                                   1





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



Notes:

  1. Some older versions of tar may incorrectly process archives containing
    pathname/filename combinations longer than 100 characters.

  2. When the storage device is an ordinary file or a block special file, -u
    and -r flags backspace.  However, raw magnetic tape devices do not support
    backspacing.  So when the storage device is a raw magnetic tape, the -u and
    -r flags rewind the tape, open it, and then read it again.

  3. Records are one block long on block magnetic tape, but they are typically
    less than half as dense on raw magnetic tape.  As a result although a
    blocked raw tape must be read twice, the total amount of tape motion is
    less than it is when reading one-block records from a block magnetic tape
    once.

  4. The structure of a streaming tape device does not support the addition of
    information at the end of a tape.  Consequently when the storage device is
    a streaming tape, the -u and -r flags are not valid options.  An attempt to
    use these flags results in the error message "tar: Update and Replace
    options not valid for a streaming tape drive".

  5. There is no way to ask for any occurrence of a file other than the last.

  6. There is no recovery from tape errors.

  7. The file storage (fstore) value for replicated files is not saved in the
    tar archive.  Files created by tar always have an fstore value of 0.

  8. The device site number (rdevsite) is not maintained for block special and
    character special files in a tar archive.  Extracted special files are
    created using the site on which the extracting tar is executing as the
    rdevsite number.

  9. If no -S flag is used and tape devices are used, tar assumes tape density
    and length so that 73,840 blocks are written to the first tape.  The system
    then prompts for a new tape.

 10. The -u and -r options are not supported for internal tape backup units.
    The -b option must specify an even-number argument.  Use the -f option to
    specify the PS/2 internal tape backup unit.  For example:

      tar -cvf/dev/rst0

FLAGS

You must supply one of the following five function flags to control the actions
of tar:

-c            Creates a new archive and writes the file at the beginning of the
              archive.




Processed November 8, 1990         TAR(1,C)                                   2





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



-r            Writes the file at the end of the archive.  Since the structure
              of a streaming tape device does not support the addition of
              information at the end of a tape, this option is not a valid flag
              when the archival storage device is a streaming tape.

-t            Lists the files in the order in which they appear in the archive.
              Files may appear more than once.

-u            Adds file to the end of the archive only if it is not in the
              archive already or if it has been modified since it was written
              to the archive.  Since the structure of a streaming tape device
              does not support the addition of information at the end of a
              tape, this is not a valid flag when the archival storage device
              is a streaming tape.

-x            Extracts file from the archive.  If you specify a directory, tar
              extracts all files in that directory from the archive.  If you do
              not specify a file or a directory, tar extracts all of the files
              from the archive.  When an archive contains multiple copies of
              the same file, tar extracts only the last one and overwrites all
              earlier ones.  If you have superuser authority (see "su"), tar
              creates all files and directories with the same user and group
              IDs as on the tape.  If you do not have superuser authority, the
              files and directories have your user and group IDs.

The other optional flags to tar are listed below.  In all cases, a directory
parameter refers to all the files and subdirectories, recursively, within that
directory.  Flags without corresponding parameters may appear separately or be
grouped together.  Flags that take parameters may have them adjacent to the
flag letter or as the entire following argument.

-bblocks              Specifies the number of 512-byte blocks per record.  The
                      default is 20, which is appropriate for tape records.
                      Due to the size of inter-record gaps, tapes written with
                      large blocking factors can hold much more data than tapes
                      with only one block per record.

                      The block size is determined automatically when tapes are
                      read (function flags -x or -t).  When archives are
                      updated with the -u and -r functions, the existing record
                      size is used.  The tar command writes archives using the
                      specified blocks value only when creating new archives
                      with the -c flag.

-B                    Forces input and output blocking to the number of blocks
                      specified with the -b option or to 20 block per record if
                      -b is not specified.  Certain devices, such as disk
                      devices, write data in record sizes independent of the
                      blocking factor.  On such a device, the blocking factor
                      cannot be determined when the device is later read.  On
                      input, the blocking factor is the default blocking factor
                      unless an explicit blocking factor is specified.



Processed November 8, 1990         TAR(1,C)                                   3





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)




-C                    If a filename is preceded by -C, then tar performs a
                      chdir(2) to that filename.  This allows multiple
                      directories not related by a close common parent to be
                      archived using short relative path names.  For example,
                      to archive files from /usr/include and /etc, one might
                      use the following command:

                           tar c -C /usr include -C / etc

-d                    Makes separate entries for directories, blocks and
                      character special files, and FIFOs.  Normally, tar writes
                      only ordinary files to an archive, and extracts only
                      ordinary files and the directories required to contain
                      them as determined by the path names in the archive.
                      When writing to an archive with the -d flag, tar makes it
                      possible to preserve the directory permission codes and
                      to restore empty directories, special files, and FIFOs
                      with the -x flag.

                      Note:  Although anyone can archive special files, only a
                             user with superuser authority can extract them
                             from an archive.

-ffile[-num]          Uses file as the archive to be read or written.  When
                      this flag is not specified, tar uses a system-dependent
                      default file name of the form /dev/rmt?.  If the file
                      specified is "-" (minus), tar writes to standard output
                      or reads from standard input.  If you write to standard
                      output, the -c flag must be used.  See the Examples
                      section below for more information.

                      If you specify num, tar provides automatic spillover from
                      one archive storage unit to another.  This feature allows
                      the operator of a system with multiple tape drives to use
                      multitape archives without having to change tapes.  For
                      example, -f/dev/rmt0-2 writes or reads /dev/rmt0,
                      followed by /dev/rmt1, and then /dev/rmt2 before
                      requesting that additional volumes be mounted.

-F                    Checks the file type before archiving.  Files or
                      directories named "SCCS" or "RCS" are identified and
                      skipped.  Core, error files, filenames ending in ".o" and
                      a.out files is archived.

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

-i                    Ignores directory checksum errors.





Processed November 8, 1990         TAR(1,C)                                   4





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



-I                    Flattens hidden directories.

                      Some newer implementations of tar may not be able to
                      extract a hidden directory file type.  For greater
                      portability, the -I flag should be used to archive hidden
                      directory component names which match the machine type on
                      which the tar command is executed.  For example, hidden
                      directory and component /bin/foo@/i386 would be extracted
                      as regular file /bin/foo.

                      If the -I flag is not used during archive, then on most
                      non-AIX implementations which follow System V, Release 2
                      or earlier tar conventions, an archived hidden directory
                      is extracted as a regular directory with '@' as the last
                      character of the directory pathname.  For example,
                      /bin/foo@/i386 archived under AIX would be extracted as
                      regular directory '/bin/foo@' containing file 'i386'.

-l                    Writes error messages to standard output if tar cannot
                      resolve all of the links to the files archived.  When you
                      do not specify this flag, the system does not display
                      these messages.

Linputlist            Writes the files listed in the inputlist file to archive.
                      The inputlist should contain one file name per line.
                      Files from inputlist are not treated recursively.  If you
                      include the name of a directory in inputlist, tar does
                      not write that directory's subdirectories to the tape,
                      only that directory's files.  If you also list files or
                      directories on the command line, the contents of
                      inputlist are included after tar has written all the
                      files or the directories and their subdirectories to the
                      archive.

-m                    Uses the time of extraction as the modification time.
                      The default is to preserve the modification time of the
                      files.

-Nblocks              Allows tar to use very large clusters of blocks when it
                      deals with streaming tape archives.  However, on input,
                      tar cannot automatically determine the block size of
                      tapes with very long block sizes created with this flag.
                      In the absence of a -Nblocks argument, the largest block
                      size that tar can automatically determine is 20 blocks.

-o                    On output, tar normally places information specifying
                      owner and modes of directories in the archive.  Former
                      versions of tar when encountering this information gives
                      error messages of the form:

                           "<name> / : cannot create"




Processed November 8, 1990         TAR(1,C)                                   5





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



-p                    This modifier says to restore files to their original
                      modes, ignoring the present umask(2).  Setuid and sticky
                      information is also restored to the superuser.

-s                    If tar fails in its attempt to link (regular link) two
                      files, with the -s option it tries to create a symbolic
                      link instead.

-S  blocksb

-S  feet

-S  feet@density      Specifies the number of 512-byte blocks per volume (first
                      format), independent of the tape blocking factor.  You
                      can also specify the size of the tape in feet by using
                      the second form, and tar assumes a default density.  The
                      third form allows you to specify both tape length and
                      density.  Feet are assumed to be 11 inches long to be
                      conservative.  This flag lets you deal more easily with
                      multivolume tape archives, where tar must be able to
                      determine how many blocks fit on each volume.

-v                    Lists the name of each file as it is processed.  With the
                      -t flag, -v gives more information about the tape
                      entries, including file sizes, times of last
                      modification, UID, and GID, and permissions.

-w                    Displays the action to be taken followed by the file
                      name, then waits for user confirmation.  If the response
                      begins with "y" or "Y", the action is performed;
                      otherwise, the file is ignored.

-num                  Uses /dev/rmtnum instead of the default.  For example, -2
                      is the same as -f/dev/rmt2.  In AIX systems with
                      multidensity tape drives, this flag allows selecting a
                      particular density.  The default unit is system dependent
                      and is chosen to match the default density, as described
                      under the -S flag.

EXAMPLES

  1. To write file1 and file2 to a new archive on the default tape drive:

      tar -c file1 file2

  2. To extract all files that are in the /tmp directory from the archive file
    on the tape device /dev/rmt2 and use the time of extraction as the
    modification time:

      tar -xm -f/dev/rmt2 /tmp





Processed November 8, 1990         TAR(1,C)                                   6





TAR(1,C)                    AIX Commands Reference                     TAR(1,C)



  3. To create a new archive file that contains file1 and pass the archive file
    to the dd command to be written to the device /dev/rmt1:

      tar -cvf - file1 | dd of=/dev/rmt1

  4. To display the names of the files in the disk archive file out.tar on the
    current directory:

      tar -vtf out.tar

  5. To expand the compressed archive file fil.tar.z, pass the file to the tar
    command, and extract all files from the expanded archive file:

      pcat fil.tar.z | tar -xvf -

  6. To create a tape archive on the default tape drive having the greatest
    potential of portability to non-AIX systems, use -I, -o (and -h if the
    target system does not support symbolic links):

      tar -cvIho ship_directory

FILES

/dev/rmt?
/tmp/tar*

COMPATIBILITY NOTE

An archive created with a non-AIX tar which contains a directory ending with
'@' is extracted as a regular directory and follows the TCF conventions for
directories ending in '@'.  For example, directory foo@ archived from a non-AIX
system is accessible as regular directory foo or foo@ when extracted under AIX.























Processed November 8, 1990         TAR(1,C)                                   7



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026