|TAR(1)||General Commands Manual||TAR(1)|
tar — tape
tar command creates, adds files to, or
extracts files from an archive file in “tar” format. A tar
archive is often stored on a magnetic tape, but can be stored equally well
on a floppy, CD-ROM, or in a regular disk file.
One of the following flags must be present:
In addition to the flags mentioned above, any of the following flags may be used:
taruses 512 byte blocks. The default is 20, the maximum is 126. Archives with a blocking factor larger 63 violate the POSIX standard and will not be portable to all systems.
taris unable to decode. This implies the
taralways generates sparse files.
oldis a basic regular expression and
newcan contain an ampersand (&), \n (where n is a digit) back-references, or subexpression matching. The
oldstring may also contain ⟨
newline⟩ characters. Any non-null character can be used as a delimiter (/ is shown here). Multiple
-sexpressions can be specified. The expressions are applied in the order they are specified on the command line, terminating with the first successful substitution. The optional trailing
gcontinues to apply the substitution expression to the pathname substring which starts with the first character following the end of the last successful substitution. The first unsuccessful substitution stops the operation of the
goption. The optional trailing
pwill cause the final result of a successful substitution to be written to
standard errorin the following format:
<original pathname> >> <new pathname>
sprevents the substitutions from being performed on symbolic link destinations.
tarto prompt the user for the filename to use when storing or extracting files in an archive.
Note SysVr3/i386 picked up ISC/SCO UNIX compatibility which
file” which was defined as obtaining a list
of command line switches and files on which to operate from the
specified file, but SunOS-5 uses “
file” because they use
-F’ to mean something else. We
might someday provide SunOS-5 compatibility but it makes little sense to
confuse things with ISC/SCO compatibility.
Note that it would be more standard to use this option to mean ``do not cross filesystem mount points.''
chroot() to the current directory before extracting files. Use with
-hto make absolute symlinks relative to the current directory.
taralways unlinks files before creating them.
tarignores filenames that contain “..” as a path component. With this option, files that contain “..” can be processed.
The options [
-014578] can be used to
select one of the compiled-in backup devices,
tar will exit with one of the following
tar cannot create a file or a
link when extracting an archive or cannot find a file while writing an
archive, or cannot preserve the user ID, group ID, file mode, or access and
modification times when the
-p option is specified,
a diagnostic message is written to standard error and a non-zero exit value
will be returned, but processing will continue. In the case where
tar cannot create a link to a file,
tar will not create a second copy of the file.
If the extraction of a file from an archive is prematurely
terminated by a signal or error,
tar may have only
partially extracted the file the user wanted. Additionally, the file modes
of extracted files and directories may have incorrect file bits, and the
modification and access times may be wrong.
If the creation of an archive is prematurely terminated by a
signal or error,
tar may have only partially created
the archive which may violate the specific archive format specification.
tar command first appeared in
Version 7 AT&T UNIX.
Keith Muller at the University of California, San Diego.
|June 18, 2011||NetBSD-7.0.1|