Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tar(C) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


     TAR(C)                               UNIX System V



     Name
          tar - archives files


     Syntax
          tar [ key ] [ files ]


     Description
          tar saves and restores files to and from an archive  medium,
          which  is  typically a storage device such as floppy disk or
          tape, or a regular file.  Its actions are controlled by  the
          key  argument.  The key is a string of characters containing
          at most  one  function  letter  and  possibly  one  or  more
          function modifiers.  Valid function letters are c, t, x, and
          e.  Other arguments to the command are files  (or  directory
          names)  specifying  which  files  are  to  be  backed  up or
          restored.  In all cases,  appearance  of  a  directory  name
          refers to the files and (recursively) subdirectories of that
          directory.  The r and u option  cannot  be  used  with  tape
          devices.

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

          r       The named  files  are  written  to  the  end  of  an
                  existing archive.

          x       The named files are extracted from the archive.   If
                  a  named file matches a directory whose contents had
                  been written onto the  archive,  this  directory  is
                  (recursively)  extracted.   The  owner, modification
                  time, and mode are restored (if  possible).   If  no
                  files  argument is given, the entire contents of the
                  archive are extracted.  Note that if  several  files
                  with  the same name are on the archive, the last one
                  overwrites all earlier ones.

          t       The names of the specified  files  are  listed  each
                  time  that  they  occur on the archive.  If no files
                  argument is given, all the names on the archive  are
                  listed.

          u       The named files are added to the archive if they are
                  not  already  there,  or  if they have been modified
                  since last written on that archive.

          c       Creates  a  new  archive;  writing  begins  at   the
                  beginning  of the archive, instead of after the last
                  file.

          The following characters may be  used  in  addition  to  the
          letter that selects the desired function:

          0,...,9999
                  This modifier selects the drive on which the archive
                  is  mounted.   The  default  is  found  in  the file
                  /etc/default/tar.

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

          w       Causes tar  to  display  the  action  to  be  taken,
                  followed  by the name of the file, and then wait for
                  the user's confirmation.  If a word beginning with y
                  is  given, the action is performed.  Any other input
                  means ``no''.

          f       Causes tar to use the next argument as the  name  of
                  the  archive instead of the default device listed in
                  /etc/default/tar.  If the name of the file is a dash
                  (-), tar writes to the standard output or reads from
                  the standard input, whichever is appropriate.  Thus,
                  tar  can  be used as the head or tail of a pipeline.
                  tar can also be used to move  hierarchies  with  the
                  command:

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

          b       Causes tar to use the next argument as the  blocking
                  factor  for  archive records.  The default is 1, the
                  maximum is 20.  This option should only be used with
                  raw magnetic tape archives (see f above).  The block
                  size is determined automatically when reading  tapes
                  (key letters x and t).

          F       Causes tar to use the next argument as the name of a
                  file from which succeeding arguments are taken.

          l       Tells tar to display an error message if  it  cannot
                  resolve  all  of the links to the files being backed
                  up.  If l is not specified, no  error  messages  are
                  displayed.

          m       Tells tar to not  restore  the  modification  times.
                  The  modification  time  of  the file is the time of
                  extraction.

          k       Causes tar to use the next argument as the  size  of
                  an  archive  volume in kilobytes.  The minimum value
                  allowed is 250.  Very large  files  are  split  into
                  ``extents''  across  volumes.  When restoring from a
                  multivolume archive, tar  only  prompts  for  a  new
                  volume  if a split file has been partially restored.
                  To override the value of  k  in  the  default  file,
                  specify k as 0 on the command line.

          e       Prevents  files  from  being  split  across  volumes
                  (tapes  or  floppy  disks).   If there is not enough
                  room on the present volume for  a  given  file,  tar
                  prompts  for  a new volume.  This is only valid when
                  the k option is also specified on the command line.

          n       Indicates the archive device is not a magnetic tape.
                  The  k  option  implies this. Listing and extracting
                  the contents of an archive are sped because tar  can
                  seek  over  files  it  wishes  to  skip.   Sizes are
                  printed in kilobytes instead of tape blocks.

          p       Indicates  that  files  are  extracted  using  their
                  original  permissions.   It  is possible that a non-
                  super-user may be unable to extract files because of
                  the   permissions   associated  with  the  files  or
                  directories being extracted.

          A       Suppresses   absolute   filenames.    Any    leading
                  ``/''characters  are removed from filenames.  During
                  extraction arguments given should match the relative
                  (rather  than  the absolute) pathnames.  With the c,
                  r, u options the A options can be  used  to  inhibit
                  putting leading slashes in the archive headers.

          tar reads /etc/default/tar to obtain default values for  the
          device,  blocking  factor,  volume size, and the device type
          (tape or non-tape).  If no numeric key is specified  on  the
          command,  tar looks for a line in the default file beginning
          with the string archive=.   Following  this  pattern  are  4
          blank  separated  strings  indicating  the  values  for  the
          device, blocking factor, volume size  and  device  type,  in
          that  order.  A volume size of `0' indicates infinite volume
          length.  This entry should be modified to reflect  the  size
          of the tape volumes used.

          For example, the following is the default device entry  from
          /etc/default/tar :

          archive=/dev/fd096ds15 10 1200 n

          The n in the last field, means that this  device  is  not  a
          tape.   Use  y  for  tape devices.  Any default value may be
          overridden on the command  line.   The  numeric  keys  (0-7)
          select  the  line  from  the  default  value  beginning with
          archive#=, where # is the  numeric  key.   When  the  f  key
          letter   is   specified  on  the  command  line,  the  entry
          "archivef=" is used.  In this case, the default  file  entry
          must   still   contain   4  strings,  but  the  first  entry
          (specifying the device) is  not  significant.   The  default
          file   /etc/default/tar  need  not  exist  if  a  device  is
          specified on the command line.


     Notes
          A critical consideration when creating a tar volume involves
          the  use  of  absolute  or relative pathnames.  Consider the
          following  tar  command  examples,  as  executed  from   the
          directory /u/target:
          tar cv /u/target/arrow

          tar cv arrow
          The first command creates a tar  volume  with  the  absolute
          pathname:  /u/target/arrow.   The second yields a tar volume
          with a relative pathname: ./arrow. (The ./ is  implicit  and
          shown  here  as  an example, ./ should not be specified when
          retrieving the file from the archive.)  When  restored,  the
          first example results in the file arrow being written to the
          directory  /u/target  (if  it  exists  and  you  have  write
          permission)  no  matter  what  your  working directory.  The
          second example simple writes the file arrow to your  present
          working directory.

          Absolute  pathnames  specify  the  location  of  a  file  in
          relation  to  the root directory (/); relative pathnames are
          relative to the current directory.  This must be taken  into
          account  when making a tar tape or disk.  Backup volumes use
          absolute pathnames so that  they  can  be  restored  to  the
          proper  directory.   Use  relative pathnames when creating a
          tar volume where absolute pathnames are unnecessary.


     Examples
          If the name of a floppy disk device is /dev/fd1, then a  tar
          format file can be created on this device by entering:

          assign /dev/fd
          tar cvfk /dev/fd1 360 files

          where files are the names of files you want archived and 360
          is  the capacity of the floppy disk in kilobytes.  Note that
          arguments to key letters are given in the same order as  the
          key  letters  themselves,  thus  the  fk  key  letters  have
          corresponding arguments /dev/fd1 and 360.  Note  that  if  a
          file  is  a  directory,  the  contents  of the directory are
          recursively archived.  To display a listing of the  archive,
          enter:

               tar tvf /dev/fd1

          At some later time you will likely want to extract the files
          from the archive floppy.  You can do this by entering:

               tar xvf /dev/fd1

          The above command extracts all files from the archive, using
          the  exact  same  pathnames  as  used  when  the archive was
          created. Because of this behavior, it is  normally  best  to
          save  archive  files  with  relative  pathnames  rather than
          absolute ones, since directory permissions may not  let  you
          read  the  files  into  the  absolute directories specified.
          (See the A flag under Options.)

          In the above examples, the v verbose option is  used  simply
          to  confirm  the  reading or writing of archive files on the
          screen. Also, a normal file could  be  substituted  for  the
          floppy device /dev/fd1 shown in the examples.


     Files
          /etc/default/tar         Default devices, blocking and
                         volume sizes, device type
          /tmp/tar*


     Diagnostics
          Displays an error  message  about  bad  key  characters  and
          archive read/write errors.

          Displays an error message if not enough memory is  available
          to hold the link tables.

     Notes
          There is no way to ask for the nth occurrence of a file.

          tar does not verify the selected media type.

          The u option can be slow.

          The limit on filename length is 100 characters.

          When archiving a directory that contains subdirectories, tar
          will  only  access  those  subdirectories that are within 17
          levels of nesting.  Subdirectories at higher levels will  be
          ignored after tar displays an error message.

          When using tar with a raw device,  specify  the  block  size
          with  the b option as a multiple of 1K.  For example, to use
          a 9K block size, enter:

               tar cvfb /dev/rfd0 18 file

          Do not enter:

               tar xfF - -

          This would imply taking two things from the  standard  input
          at the same time.

          Use error-free floppy disks for best results with tar.


     Standards Conformance
          tar is conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          and The X/Open Portability Guide II of January 1987.


     (printed 2/15/90)                                     TAR(C)


























































































































































































































































































































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