Tar Manual Page

     tar - multivolume archiver

     tar [key] [name...]


     The tape archiver command, tar, saves and restores multiple files to and
     from a single archive.  The default archive device is /dev/rmt0h, but
     any file or device may be requested through the use of options.

     The key is a string of characters containing at most one function letter
     and possibly names specifying which files to dump or restore.  In all
     cases, appearance of a directory name refers to the files and (recur-
     sively) subdirectories of that directory.

     This utility supports EOT handling which allows the use of multiple
     media.  The utility prompts for the next volume when it encounters the
     end of the current volume.

   Function Keys
     The function portion of the key is specified by one of the following

     c       Create a new archive on tape, disk or file.  Writing starts at
             the beginning of the archive instead of after the last file.

     r       Write the named files to the end of the archive.

     t       List the names of the files as they occur on the input archive.

     u       Add the named files to the archive if they are not there already
             or if they have been modified since they were last put in the

     x       Extract the named files from the archive.  If the named file
             matches a directory whose contents had been written into the
             archive, the directory is recursively extracted.  The owner,
             modification time, and mode are restored, if possible.  If no
             file argument is given, the entire content of the archive is
             extracted.  Note that if multiple entries specifying the same
             file are in the archive, the last one overwrites all previous
             versions extracted.

     You can use one or more of the following options in addition to the
     letter which selects the function desired:

     0...9     Substitute number for the device unit number as in /dev/rmt#h.
               The default is the high density rewind tape device number zero
               named /dev/rmt0h.  The following tar command uses device

               % tar cv4 tar.c

     A         Use next argument as archive number with which to begin out-

     B         Force input and output blocking to 20 blocks/record. This
               option allows tar to work across a communications channel
               where the blocking may not be maintained.

     D         Directory output in original tar style.

     C         Use to perform a directory change prior to archiving data.

     F[ F ]    Operate in fast mode . When F is specified, tar skips all SCCS
               directories, core files, and error files.  When FF is speci-
               fied, tar also skips all a.out and *.o files.

     H         Help mode.  Print a summary of the function keys and options.

     M         Next argument specifies maximum archive number to be written
               and prints current archive number on output line.

     N         No multi-archive, file splitting, or new header format on out-
               put.  Output directories in previous tar format. On input, set
               file UID and GID from file header vs. values in /etc/passwd
               and group files.

     O         Include file owner and group names in verbose output (t and x
               functions) if present in archive header.  Output warning mes-
               sage if owner or group name not found in /etc/passwd or
               /etc/group file (cru functions).

     P         Used to specify POSIX format tapes.  Necesary only with the c

     R         Each named file contains a list of file names separated by
               newlines which is added to (c function key) or extracted from
               (x function key) the archive.

     S         Output User Group Standard archive format.

     V         Display extended verbose information.  Included are the ver-
               sion number of tar, the number of blocks used on the device,
               the number of blocks in a file, and the protection modes given
               in a format similar to the ls -l command.  In addition to this
               information, V provides the information given by the v option.

     b         Use the next argument as the blocking factor for tape records.
               The default is 20 (the maximum is 127).  This option should
               only be used with raw magnetic tape archives (see the f
               option).  The block size is determined automatically when
               reading tapes (x and t) keys. See the Restrictions section.

     d         Use /dev/rra1a as the default device.  The mdtar command is
               recommended for use with floppy disks.

     f         Use the next argument as the name of the archive instead of
               /dev/rmt0h.  If the name of the file is - , tar writes to
               standard output or reads from standard input, whichever is
               appropriate.  Thus, tar can be used as the head or tail of a
               filter chain.  You can also use tar to move hierarchies.  The
               following example shows how to move the directory fromdir to
               the directory todir:

               # cd fromdir; tar cf - . | (cd todir; tar xpf -)

     h         Save a copy of the actual file on the output device under the
               symbolic link name, instead of placing the symbolic informa-
               tion on the output.  The default action of tar is to place
               symbolic link information on the output device.  A copy of the
               file itself is not saved on the output device.

     i         Ignore checksum errors found in the archive.

     l         Complain if tar cannot resolve all of the links to the files
               dumped.  If this is not specified, no error messages are

     m         Do not restore the modification times.  The modification time
               is the time of extraction.  Tar normally restores modification
               times of regular and special files.

     o         Suppress the normal directory information.  On output, tar
               normally places information specifying owner and modes of
               directories in the archive.  Former versions of tar, when
               encountering this information will give error message of the
               following form:

               name: cannot create

               The tar command will place information specifying owner and
               modes of directories in the archive.

     p         Restore the named files to their original modes, ignoring the
               present umask(2).  Setuid and sticky bit information is also
               restored to the superuser.
     s         Next argument specifies size of archive in 512 byte blocks.

     v         Write the name of each file treated, preceded by the function
               letter, to diagnostic output. Normally, tar does its work
               silently.  With the t function key, the verbose option pro-
               vides more information about the tape entries than just their

               #cd /
               #tar cvf tar-out vmunix

               The preceeding command produces the output ``a vmunix 1490
               blocks'' where 1490 is the number of 512 byte blocks in the
               file ``vmunix''.

               #tar xvf tar-out
               The proceeding command produces the output ``x vmunix, 762880
               bytes, 1490 blocks'' where 762880 is the number of bytes and
               1490 is the number of 512 byte blocks in the file ``vmunix''
               which was extracted.

     w         Print the action to be taken, followed by file name, then wait
               for user confirmation.  If a word beginning with the letter y
               is given, the action is done.  Any other input means do not do

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

     Tape errors are handled ungracefully.

     The u key can be slow.

     The limit on file name length is 100 characters.

     There is no way to follow symbolic links selectively.

     On SCSI tape devices tar (when reading) may end on one volume of a mul-
     tivolume set without prompting for the next volume. This is a very
     infrequent condition. The next volume should be loaded and the command
     issued again.

     Using a blocking factor other than the default (b option) may lead to
     higher performance. However, you must select a value that is compatible
     with the hardware limitations of the source and destination machines.
     Software limitations may apply for other versions of tar.

     When extracting (x), tar reads the entire tape. See the r and u keys.

     The u and the r function keys do not operate with quarter-inch tape car-
     tidge drives such as the TZK10.

     To archive files from /usr/include and /etc, type:

     # tar c -C /usr/include . -C /etc .

     The tar command can properly handle blocked archives.

     The tar command produces diagnostics when it encounters bad key charac-
     ters, read/write errors and when there is not enough memory available to
     hold the link tables.


Last update: May 2014.