TAR(1) COMMAND REFERENCE TAR(1) NAME tar - tape archiver SYNOPSIS tar key [ tapefilename ] [ blocksize ] [ name ... ] DESCRIPTION Tar saves and restores multiple files on a single file (usually a magnetic tape, but it can be any file). Tar's actions are controlled by the key argument. The key consists of one (or possibly two) "function" letter(s) and possibly one or more function modifiers. These are listed in the OPTIONS section. The key may be preceded by a dash (-), but this is optional. The tapefilename argument is given with the f option. If this is a dash (-), standard input or standard output is used for input or output. The blocksize argument is given only if the b option is given. The name arguments are the names of the files and directories to be archived. The names may be preceded by a -C, which specifies that tar is to chdir(2) (change directories) to that directory name (this is useful when the directories to be archived do not have a close common parent and it is undesirable to save a large directory structure). All arguments following that name until the next -C is taken to be relative to that name. The name following the -C is not archived. If the name begins with a slash (/), tar also does a chdir to the directory, but only to archive that directory. After that, the current directory is changed back to what it was before. Directories are recursively archived, meaning that the contents of the directory, its subdirectories, and so forth are all archived. Previous restrictions dealing with tar's inability to properly handle blocked devices have been lifted. OPTIONS The function portion of the key is specified by one of the following letters (Exception: both c and r may be given, since c implies r): c Create a new tape; writing begins on the beginning of the tape instead of after the last file. This command implies r. r The named files are written on the end of the tape. The c function implies this. (NOTE: Some streaming tape drives cannot support this function. In this case, an error Printed 4/6/89 1
TAR(1) COMMAND REFERENCE TAR(1) message will be printed to this effect.) t The names of the specified files are listed each time they occur on the tape. If no file argument is given, all of the names on the tape are listed. u The named files are added to the tape if either they are not already there or have been modified since last put on the tape. (NOTE: Some streaming tape drives can not support this function. In this case, an error message will be printed to this effect.) x The named files are extracted from the tape. If the named file matches a directory whose contents had been written onto the tape, this 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 tape is extracted. Note that if multiple entries specifying the same file are on the tape, the last one overwrites all earlier. The following are function modifiers: b Tar uses the next argument as the number of 512 byte blocks to use for tape records. The default is 20. This option should only be used with raw magnetic tape archives (See f below). The block size is determined automatically when reading tapes (function letters x and t). f Tar uses the next argument as the name of the archive instead of /dev/rmt?. If the name of the file is a dash (-), 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. Tar can also be used to move hierarchies with the command: cd fromdir; 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. i Tar stores a checksum for each directory in order to check for read/write errors and corrupted tapes. Normally, a checksum error will cause tar to terminate. The i option tells tar to ignore directory checksum errors. These files will be ignored. l Tells tar to complain if it cannot resolve all of the links to the files dumped. If this is not specified, no error messages are printed. Printed 4/6/89 2
TAR(1) COMMAND REFERENCE TAR(1) m Tells tar not to restore the modification times. The modification time will be the time of extraction. o 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 form: <name>/: cannot create. This option will suppress the directory information. p This option says to restore files to their original modes, ignoring the present umask(2). Setuid and sticky information will also be restored to the superuser. v Normally tar does its work silently. The v (verbose) option makes tar print the name of each file it treats preceded by the function letter (in the case of c and r, the letter a says that the file was added, and r says that the file was replaced). With the t function, the verbose option gives more information about the tape entries than just their names. All information is printed on the standard error, so redirection of output must take this into account. w Tar prints the action to be taken followed by filename, then waits for user confirmation. If a word beginning with y is given, the action is done. Any other input means don't do it. B Forces input and output blocking to 20 blocks per record. This option was added so that tar can work across a communications channel where the block may not be maintained. F If given once, any directories named SCCS or RCS and any files named core or errs are ignored. If given twice, any files named a.out or having the suffix .o are also ignored. T Take list of filenames and -C commands from standard input. W Like w, but produces a very terse description of the action to be taken. 0, ..., 9 This modifier selects an alternate drive on which the tape is mounted. The default is /dev/rmt8. Printed 4/6/89 3
TAR(1) COMMAND REFERENCE TAR(1) EXAMPLES To archive files from /usr/include and from /etc, you might use one of the following: tar c -C /usr include -C / etc tar c /usr/include /etc To archive all files in a directory, you could use the following: find . -print | tar Tc FILES /dev/rmt8 The default input/output archive file /tmp/tar* Temporary file for the u function CAVEATS The r and u functions may not be available with some tape drives, such as streaming tape drives. In order to keep streaming tapes streaming, it is recommended that a blocking factor (for the b modifier) of 256 be given. This will cause tar to buffer the data in 128 kbyte blocks. There is no way to ask for the n-th occurrence of a file. Tape errors are handled ungracefully. The u option can be slow. The current limit on file name length is 100 characters. If longer file names are required and portability to other systems is not required, see cpio(1). There is no way to selectively follow symbolic links. SEE ALSO ar(1), cpio(1), cpio(5), tar(5), dump(8), and restore(8). Printed 4/6/89 4
%%index%% na:216,71; sy:287,233; de:520,2115; op:2635,648;3571,3009;6868,2676; ex:9832,399; fi:10231,198; ca:10429,844; se:11273,214; %%index%%000000000157