Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tar(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

tar

PURPOSE

     Manipulates archives.

SYNOPSIS
     tar [ -crtux ] [ -vwdmlh ] [ -bblocks ] [ -ffilename[-count] ]
     [ -Cblocks ] [ -number ] [ -iinputlist ] [-sblocksb] [ -sfeet[@density] ]
     [ name ... ]


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.

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

     Notes:

     1.  When the  storage device is  a 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.

     2.  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.

     3.  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".

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

     5.  There is no recovery from tape errors.

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.
     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 sepa-
     rately or  be grouped together.  Flags  that take parame-
     ters 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
                         16,  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 automat-
                         ically 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.

                         For output to ordinary files with the
                         -f flag,  you can save disk  space by
                         using a blocking  factor that matches
                         the size of disk blocks (for example,
                         -b4   for  2048-byte   disk  blocks).
                         Ordinary files must be read using the
                         same blocking  factor used  when they
                         were created.
     -Cblocks            Allows tar to use very large clusters
                         of   blocks   when  it   deals   with
                         streaming   tape   archives.    Note,
                         however,  that 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  -Cnum  argument,  the
                         largest block size that tar can auto-
                         matically determine is 20 blocks.
     -d                  Makes  separate entries  for directo-
                         ries,  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 pre-
                         serve 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 example.

                         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   multi-tape   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.
     -h                  Ignores header  checksum errors.  The
                         tar command writes a file header con-
                         taining a  checksum for each  file in
                         the archive.   When this flag  is not
                         specified,  the  system verifies  the
                         contents  of  the  header  blocks  by
                         recomputing the  checksum, and aborts
                         with  a  "directory  checksum  error"
                         when  a mismatch  occurs.  When  this
                         flag is specified, tar logs the error
                         and then scans forward until it finds
                         a valid  header block.   This permits
                         restoring files from later volumes of
                         a   multi-volume    archive   without
                         reading earlier volumes.
     -iinputlist         Writes  the   files  listed   in  the
                         inputlist file  to the  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 directo-
                         ries and their  subdirectories to the
                         archive.
     -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.
     -m                  Uses  the time  of extraction  as the
                         modification time.  The default is to
                         preserve the modification time of the
                         files.
     -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 conserva-
                         tive.  This  flag lets you  deal more
                         easily    with   multi-volume    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 fol-
                         lowed  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
                         multi-density 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

     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 -

FILES

     /dev/rmt?
     /tmp/tar*

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