TAR(1) TAR(1)
NAME
tar - archiver
SYNOPSIS
tar key [ file ... ]
DESCRIPTION
Tar saves and restores file trees. It is most often used to
transport a tree of files from one system to another. The
key is a string that contains at most one function letter
plus optional modifiers. Other arguments to the command are
names of files or directories to be dumped or restored. A
directory name implies all the contained files and subdirec-
tories (recursively).
The function is one of the following letters:
c Create a new archive with the given files as contents.
r The named files are appended to the archive.
t List all occurrences of each file in the archive, or of
all files if there are no file arguments.
x Extract the named files from the archive. If a file is
a directory, the directory is extracted recursively.
Modes are restored if possible. If no file argument is
given, extract the entire archive. If the archive con-
tains multiple entries for a file, the latest one wins.
The modifiers are:
f Use the next argument as the name of the archive
instead of the default standard input (for keys x and
t) or standard output (for keys c and r).
g Use the next (numeric) argument as the group id for
files in the output archive.
k (keep) Modifies the behavior of x not to extract files
which already exist.
m Do not set the modification time on extracted files.
This is the default behavior; the flag exists only for
compatibility with other tars.
p Create archive in POSIX ustar format, which raises the
maximum pathname length from 100 to 256 bytes. Ustar
archives are recognised automatically by tar when read-
ing archives. This is the default behavior; the flag
Page 1 Plan 9 (printed 10/27/25)
TAR(1) TAR(1)
exists only for backwards compatibility with older ver-
sions of tar.
P Do not generate the POSIX ustar format.
R When extracting, ignore leading slash on file names,
i.e., extract all files relative to the current direc-
tory.
T Modifies the behavior of x to set the modified time of
each file to that specified in the archive.
u Use the next (numeric) argument as the user id for
files in the output archive. This is only useful when
moving files to a non-Plan 9 system.
v (verbose) Print the name of each file treated preceded
by the function letter. With t, give more details
about the archive entries.
z Operate on compressed tar archives. The type of com-
pression is inferred from the file name extension:
gzip(1) for .tar.gz and .tgz; bzip2 (see gzip(1)) for
.tar.bz, .tbz, .tar.bz2, and .tbz2; compress (not dis-
tributed) for .tar.Z and .tz. If no extension matches,
gzip is used. The z flag is unnecessary (but allowed)
when using the t and x verbs on archives with recog-
nized extensions.
EXAMPLES
Tar can be used to copy hierarchies thus:
@{cd fromdir && tar cp .} | @{cd todir && tar xT}
SOURCE
/usr/local/plan9/src/cmd/tar.c
SEE ALSO
9ar in 9c(1), bundle(1)
BUGS
There is no way to ask for any but the last occurrence of a
file.
File path names are limited to 100 characters (256 when
using ustar format).
The tar format allows specification of links and symbolic
links, concepts foreign to Plan 9: they are ignored.
Page 2 Plan 9 (printed 10/27/25)