blob: 4a18d6c8d24ec071d1d64c1776b084686b041324 [file] [log] [blame]
tar \- archiver
.B tar
.I key
.I file ...
.I Tar
saves and restores file trees.
It is most often used to transport a tree of files from one
system to another.
.I 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 subdirectories (recursively).
The function is one of the following letters:
.B c
Create a new archive with the given files as contents.
.B r
The named files
are appended to the archive.
.B t
List all occurrences of each
.I file
in the archive, or of all files if there are no
.I file
.B 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 contains multiple entries for a file,
the latest one wins.
The modifiers are:
.B f
Use the next argument as the name of the archive instead of
the default standard input (for keys
.B x
.BR t )
or standard output (for keys
.B c
.BR r ).
.B g
Use the next (numeric) argument as the group id for files in
the output archive.
.B k
Modifies the behavior of
.B x
not to extract files which already exist.
.B m
Do not set the modification time on extracted files.
This is the default behavior; the flag exists only for compatibility with other tars.
.B p
Create archive in POSIX ustar format,
which raises the maximum pathname length from 100 to 256 bytes.
Ustar archives are recognised automatically by
.I tar
when reading archives.
This is the default behavior; the flag exists only for backwards compatibility
with older versions of tar.
.B P
Do not generate the POSIX ustar format.
.B R
When extracting, ignore leading slash on file names,
i.e., extract all files relative to the current directory.
.B T
Modifies the behavior of
.B x
to set the modified time
of each file to that specified in the archive.
.B 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.
.B v
Print the name of each file treated
preceded by the function letter.
.BR t ,
give more details about the
archive entries.
.B z
Operate on compressed tar archives.
The type of compression is inferred from the file name extension:
.IR gzip (1)
.B .tar.gz
.BR .tgz ;
.I bzip2
.IR gzip (1))
.BR ,
.BR .tbz ,
.BR .tar.bz2 ,
.BR .tbz2 ;
.I compress
(not distributed)
.B .tar.Z
.BR .tz .
If no extension matches,
.I gzip
is used.
.B z
flag is unnecessary (but allowed) when using the
.B t
.B x
verbs on archives with recognized extensions.
.I Tar
can be used to copy hierarchies thus:
@{cd fromdir && tar cp .} | @{cd todir && tar xT}
.B \*9/src/cmd/tar.c
.I 9ar
.IR 9c (1),
.IR bundle (1)
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.