TAR(1) HP-UX 5.0 TAR(1) NAME tar - tape file archiver SYNOPSIS tar [key] [ [ file | -C directory ] ... ] HP-UX COMPATIBILITY Level: HP-UX/DEVELOPMENT Origin: System III and UCB Native Language Support: 8-bit filenames. DESCRIPTION Tar saves and restores files on magnetic tape or flexible disc. 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. The key string may be preceded by a dash (-) (similar to the way options are specified in other HP-UX commands), but it is not necessary. Other arguments to the command are files (or directory names) specifying which files are to be dumped or restored. In all cases, appearance of a directory name refers to the files and (recursively) subdirectories of that directory. The function portion of the key is specified by one of the following letters: r The named files are added to the end of the archive. The c function implies this function. 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. If a named file on tape does not exist on the system, the file is created as follows: The user, group, and other protections are restored from the tape. The modification time is restored from the tape unless the m option is specified. The file owner and group owner are normally that of the restoring process. The set-user-ID, set-group-ID and sticky bits are normally not set. The o and p options control the restoration of protection; see below for more details. If the files exist, their modes are not changed except that the set-user-ID, set-group-ID and sticky bits are cleared. If no files argument is given, the entire content of the archive is 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 all the files on the archive are listed. Adding the v option will expand this listing to include the file modes and owner numbers. The names of all files are listed each time that they occur on the tape. u The named files are added to the archive if they are not already there, or have been modified since last written on that archive. c Create a new archive; writing begins at the beginning of the archive, instead of after the last file. This command implies the r function. The following function modifiers may be used in addition to the function letters listed above: #s Where # is a tape drive number (0,...,7), and s is the density (l - low (800 bpi), m - medium (1600 bpi), or h - high (6250 bpi)). This modifier selects the drive on which the 9 track tape is mounted. The default is 0m. v Normally, tar does its work silently. The v (verbose) option causes it to type the name of each file it treats, preceded by the function letter. With the t function, v gives more information about the tape entries than just the name. w Causes tar to print 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 /dev/rmt/??. If the name of the file is -, 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. If both f and b modifiers are specified, their arguments must match the order in which they are specified. This option should only be used when a blocking factor other than 1 is desired. The default is 1 (512 bytes) and the maximum is 20. The block size is determined automatically when reading 9 track tapes (key letters x and t). The blocking factor must be specified when reading flexible discs and cartridge tapes if they were written with a blocking factor different than the default. l Tells tar to complain if it cannot resolve all of the links to the files being dumped. If l is not specified, no error messages are printed. m Tells tar to not restore the modification time written on the archive. The modification time of the file will be the time of extraction. h Forces tar to follow symbolic links as if they were normal files or directories. Normally, tar does not follow symbolic links. Not all HP-UX systems support symbolic links. o For writing: This option suppresses writing certain directory information that older versions of tar cannot handle on input. Tar normally writes information specifying owners and modes of directories in the archive. Former versions of tar, when encountering this information, will give error message of the form "/: cannot create". This option will suppress writing that information. For reading: Causes extracted files to take on the user and group identifier of the user running the program rather than those on the tape. This is the default for the ordinary user, and may be overridden, to the extent the system protections allow, by the p option. p This option causes files to be restored to the original modes and ownerships written on the archive, if possible. This is the default for the super-user, and may be overridden by the o option. For the ordinary used, if the system protections forbid the chown(2) operation needed to do this, the error will be ignored, and the ownership left with the restoring process. Set-user-ID, set-group-ID and sticky information will be restored as allowed by the protections defined by chmod(2), if the chown operation above succeeded. The following option may be included in the file list: -Cdirectory tar will perform a chdir(2) to directory. This allows multiple directories not related by a close common parent to be archived using short relative path names. If a 9 track tape drive is used as the output device, it must be configured in Berkeley compatability mode; see mt(4). EXAMPLES tar cvf /dev/rfd.0 file1 file2 This example creates a new archive on /dev/rfd.0 and copies file1 and file2 onto it, using a blocking factor of 20. The key is made up of one function letter (c) and two function modifiers (v, and f). tar cv -C /usr include -C / etc This example archives files from /usr/include and from /etc. FILES /dev/rmt/* /dev/rfd.* /tmp/tar* SEE ALSO ar(1), cpio(1), mt(4). DIAGNOSTICS Complaints about bad key characters and tape read/write errors. Complaints if enough memory is not available to hold the link tables. BUGS 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. If the archive is on a flexible disc or cartridge tape, and if the blocking factor specified on output was not the default, the same blocking factor must be specified on input. This is because the blocking factor is not explicitly stored on the archive. Not following this rule and updating the archive can destroy it. The current limit on file-name length is 100 characters. Some previous versions of tar have claimed to support selective listing of file names using the t option with a list. To our knowledge this was an error in the documentation and does not appear in the original source code. There is no way to restore an absolute path name to a relative position. Archives should never be created on block special devices (e.g., /dev/fd.o). Tar always pads information written to an archive up to the next multiple of the block size. Therefore, if you are creating a small archive and write out one block of information, tar reports that one block was written, but the actual size of the archive may be larger if the b option was used. Note that tar c0m is not the same as tar cm0.