tar(1)tar(1)NAMEtar - tape file archiver
SYNOPSIS
[arg]... [file |
DESCRIPTION
The command saves and restores archives of files on a magnetic tape, a
flexible disk, or a regular file. The default archive file is If the
legacy DSF is disabled, the default value is See the option below. Its
actions are controlled by the key argument.
Arguments
key is a string of characters containing exactly one function
letter and zero or more function modifiers, specified in
any order. Whitespace is not permitted in key. The key
string can be preceded by a hyphen as when specifying
options in other HP-UX commands, but it is not necessary.
arg ... The and function modifiers each require an arg argument
(see below). If both and are specified, the order of the
arg arguments must match the order of the modifiers. If
specified, the arg arguments must be separated from the
key and each other by whitespace.
file specifies a file being saved or restored. If file is a
directory name, it refers to the files and (recursively)
the subdirectories contained in that directory.
causes to perform a to directory (see chdir(2)). Subsequent
file and arguments are relative to directory. This
allows multiple directories not related by a close or
common parent to be archived using short relative path
names.
The value of file is stored in the archive. The value of directory is
not stored.
Function Keys
The function portion of the key is specified by exactly one of the fol‐
lowing letters:
Create a new archive.
Write from the beginning of the archive instead of
appending after the last file. Any previous information
in the archive is overwritten.
Add the named
file to the end of the archive. The same blocking factor
used to create the archive must be used to append to it.
This option cannot be used if the archive is a tape.
List the names of all the files in the archive.
Adding the function modifier expands this listing to
include the file modes and owner numbers. The names of
all files are listed each time they occur on the tape.
Add any named
file to the archive if it is not already present or has
been modified since it was last written in the archive.
The same blocking factor used to create the archive must
be used to update it.
Extract the named
file from the archive and restore it to the system. If a
named file matches a directory whose contents were writ‐
ten to 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 function modifier is specified.
· The file user ID and group ID are normally those of the
restoring process.
· The set-user-ID, set-group-ID, and sticky bits are not
set automatically. The and function modifiers control
the restoration of protection; see below for more
details.
If the files exist, their modes are not changed, but the
set-user-id, set-group-id and sticky bits are cleared.
If no file 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.
Function Modifier Keys
The following function modifiers can be used in addition to the func‐
tion letters listed above (note that some modifiers are incompatible
with some functions):
Suppress warning messages that
did not archive a file's access control list. By
default, writes a warning message for each file with
optional ACL entries.
Use the next
arg argument as the blocking factor for archive records.
The default is 20; the maximum is at least 20. However,
if the modifier is used to specify standard input, the
default blocking factor is 1.
The blocking factor is determined automatically when
reading nine-track tapes (key letters and On nine-track
tapes, the physical tape record length is the same as the
block size. The block size is defined as the logical
record size times the blocking factor (number of logical
records per block).
The blocking factor must be specified when reading flexi‐
ble disks and cartridge tapes if they were written with a
blocking factor other than the default.
If a file is read using a blocking factor not equal to
the one used when the file was written, an error may
occur at the end of the file but there may or may not be
an actual error in the read. To prevent this problem, a
blocking factor of can be used, although performance may
be reduced somewhat.
writes logical records of 512 bytes, independent of how
logical records may be defined elsewhere by other pro‐
grams (such as variable-length records (lines) within an
ASCII text file).
Fail if the extent attributes are present in the files to be
archived.
If fails for this reason, the partially created destina‐
tion file is not be removed.
Use the next
arg argument as the name of the archive instead of the
default, If the legacy DSF is disabled the default value
is If the name of the file is writes to standard output
or reads from standard input, whichever is appropriate,
and the default blocking factor becomes 1. Thus, can be
used as the head or tail of a pipeline (see EXAMPLES).
Force to follow symbolic links as if they were normal files or
directories. Normally, does not follow symbolic links.
Tell to complain if it cannot resolve all of the links to the
files being saved. If is not specified, no error mes‐
sages are printed.
Tell not to restore the modification time written on the ar‐
chive. The modification time of the file will be the
time of extraction.
Write a POSIX format archive.
This format allows file names of up to 256 characters in
length, and correctly archives and restores the following
file types: regular files, character and block special
devices, links, symbolic links, directories, and FIFO
special files. It also stores the user and group name of
each file and attempts to use these names to determine
the user-ID and group-ID of a file when restoring it with
the function modifier. This is the default format.
Suppress writing certain directory information that older ver‐
sions of
cannot handle on input. normally writes information
specifying owners and modes of directories in the ar‐
chive. Earlier versions of when encountering this infor‐
mation, give error messages of the form:
When is used for reading, it causes the extracted file to
take on the user and group IDs of the user running the
program rather than those on the tape. This is the
default for the ordinary user and can be overridden, to
the extent that system protections allow, by using the
function modifier.
Write a pre-POSIX format archive.
Cause file to be restored to the original modes and ownerships
written on the archive, if possible. This is the default
for the superuser, and can be overridden by the function
modifier. If system protections prevent the ordinary
user from executing the error is ignored, and the owner‐
ship is set to that of the restoring process (see
chown(2)). The set-user-id, set-group-id, and sticky bit
information are restored as allowed by the protections
defined by if the operation above succeeds.
nd Specify a particular nine-track tape drive and density,
where n is a tape drive number: and d is the density: =
low (800 bpi); = medium (1600 bpi); = high (6250 bpi).
This modifier selects the drive on which the nine-track
tape is mounted. The default is
Normally,
does its work silently. The (verbose) function modifier
causes to type the name of each file it treats, preceded
by the function letter. With the function, gives more
information about the archive entries than just the name.
Same as the
function modifier except that, when using the option,
also prints out a letter indicating the type of the
archived file.
Cause to print the action being taken, followed by the name of
the file, then wait for the user's confirmation. If the
user answers the action is performed. Any other input
means "no".
When end-of-tape is reached, prompts the user for a new special file
and continues.
If a nine-track tape drive is used as the output device, it must be
configured in Berkeley-compatibility mode (see mt(7)).
The function modifiers specify the format in which writes the archive.
Upon extraction, can read either format, regardless of the function
modifiers used.
EXTERNAL INFLUENCES
Environment Variables
determines the format and contents of date and time strings output when
listing the contents of an archive with the option.
determines the language equivalent of (for yes/no queries).
If is not specified in the environment or is set to the empty string,
the value of is used as the default.
If is not specified or is set to the empty string, it defaults to "C"
(see lang(5)).
If any internationalization variable contains an invalid setting,
behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multibyte character code sets are supported.
DIAGNOSTICS
issues self-explanatory messages about bad key characters, tape
read/write errors, and if not enough memory is available to hold the
link tables.
EXAMPLES
Create a new archive on and copy and onto it, using the default block‐
ing factor of 20. The key is made up of one function letter and two
function modifiers and
Archive files from and
Use in a pipeline to copy the entire file system hierarchy under
fromdir to todir:
Archive all files and directories in directory in the current directory
to a file called also in the current directory:
WARNINGS
Because of industry standards and interoperability goals, does not sup‐
port the archival of files of size 8GB or larger, files that have
user/group ID values of 2097152 (2^21) or greater, or files belonging
to a user/group name of 32 characters or greater.
Files with user/group ID values of 2097152 (2^21) or greater are
archived and restored using the original user/group name of the file.
If the user/group name is not found when restoring the file, then the
user/group ID of the current process is used. If the user/group name
was truncated to fit in the header, a false match may be made when
restoring with this truncated value if the truncated value is the same
as another user/group name on that system. For more information see
tar(4).
Due to internal limitations in the header structure, not all file names
of fewer than 256 characters fit when using the function modifier. If
a file name does not fit, prints a message and does not archive the
file.
Link names are still limited to 100 characters when using the function
modifier.
There is no way to ask for the n-th occurrence of a file.
Tape errors are handled ungracefully.
The function key can be slow.
If the archive is a file on disk, flexible disk, or cartridge tape, and
if the blocking factor specified on output is not the default, the same
blocking factor must be specified on input, because the blocking factor
is not explicitly stored in the archive. Updating or appending to the
archive without following this rule can destroy it.
Some previous versions of have claimed to support the selective listing
of file names using the function key with a list. This appears to be
an error in the documentation because the capability does not appear in
the original source code.
There is no way to restore an absolute path name to a relative posi‐
tion.
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, reports that one block was written,
but the actual size of the archive might be larger if the function mod‐
ifier is used.
Note that is not the same as
Do not create archives on block special devices. Attempting to do so
can causes excessive wear, leading to premature drive hardware failure.
DEPENDENCIES
The and function keys are not supported on QIC or 8mm devices. If
these options are used with QIC or 8mm devices, fails and displays the
message:
AUTHOR
was developed by AT&T, the University of California, Berkeley, HP, and
POSIX.
FILESSEE ALSOar(1), cpio(1), acl(5), mt(7).
STANDARDS CONFORMANCEtar(1)