|
Packit Service |
1d0348 |
TAR(1) manual page
|
|
Packit Service |
1d0348 |
== NAME ==
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
- manipulate tape archives
|
|
Packit Service |
1d0348 |
== SYNOPSIS ==
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''bundled-flags'' <args><nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki><''file''> | <''pattern''> ...<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
<nowiki>{</nowiki>-c<nowiki>}</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''options''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''files'' | ''directories''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
<nowiki>{</nowiki>-r | -u<nowiki>}</nowiki>
|
|
Packit Service |
1d0348 |
-f ''archive-file''
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''options''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''files'' | ''directories''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
<nowiki>{</nowiki>-t | -x<nowiki>}</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''options''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
<nowiki>[</nowiki>''patterns''<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
== DESCRIPTION ==
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
creates and manipulates streaming archive files.
|
|
Packit Service |
1d0348 |
This implementation can extract from tar, pax, cpio, zip, jar, ar, xar,
|
|
Packit Service |
1d0348 |
rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip,
|
|
Packit Service |
1d0348 |
7-zip, and shar archives.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The first synopsis form shows a
|
|
Packit Service |
1d0348 |
"bundled"
|
|
Packit Service |
1d0348 |
option word.
|
|
Packit Service |
1d0348 |
This usage is provided for compatibility with historical implementations.
|
|
Packit Service |
1d0348 |
See COMPATIBILITY below for details.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The other synopsis forms show the preferred usage.
|
|
Packit Service |
1d0348 |
The first option to
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is a mode indicator from the following list:
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
-c
|
|
Packit Service |
1d0348 |
Create a new archive containing the specified items.
|
|
Packit Service |
1d0348 |
The long option form is
|
|
Packit Service |
1d0348 |
--create.
|
|
Packit Service |
1d0348 |
-r
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
-c,
|
|
Packit Service |
1d0348 |
but new entries are appended to the archive.
|
|
Packit Service |
1d0348 |
Note that this only works on uncompressed archives stored in regular files.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
-f
|
|
Packit Service |
1d0348 |
option is required.
|
|
Packit Service |
1d0348 |
The long option form is
|
|
Packit Service |
1d0348 |
--append.
|
|
Packit Service |
1d0348 |
-t
|
|
Packit Service |
1d0348 |
List archive contents to stdout.
|
|
Packit Service |
1d0348 |
The long option form is
|
|
Packit Service |
1d0348 |
--list.
|
|
Packit Service |
1d0348 |
-u
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
-r,
|
|
Packit Service |
1d0348 |
but new entries are added only if they have a modification date
|
|
Packit Service |
1d0348 |
newer than the corresponding entry in the archive.
|
|
Packit Service |
1d0348 |
Note that this only works on uncompressed archives stored in regular files.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
-f
|
|
Packit Service |
1d0348 |
option is required.
|
|
Packit Service |
1d0348 |
The long form is
|
|
Packit Service |
1d0348 |
--update.
|
|
Packit Service |
1d0348 |
-x
|
|
Packit Service |
1d0348 |
Extract to disk from the archive.
|
|
Packit Service |
1d0348 |
If a file with the same name appears more than once in the archive,
|
|
Packit Service |
1d0348 |
each copy will be extracted, with later copies overwriting (replacing)
|
|
Packit Service |
1d0348 |
earlier copies.
|
|
Packit Service |
1d0348 |
The long option form is
|
|
Packit Service |
1d0348 |
--extract.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
In
|
|
Packit Service |
1d0348 |
-c,
|
|
Packit Service |
1d0348 |
-r,
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
-u
|
|
Packit Service |
1d0348 |
mode, each specified file or directory is added to the
|
|
Packit Service |
1d0348 |
archive in the order specified on the command line.
|
|
Packit Service |
1d0348 |
By default, the contents of each directory are also archived.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
In extract or list mode, the entire command line
|
|
Packit Service |
1d0348 |
is read and parsed before the archive is opened.
|
|
Packit Service |
1d0348 |
The pathnames or patterns on the command line indicate
|
|
Packit Service |
1d0348 |
which items in the archive should be processed.
|
|
Packit Service |
1d0348 |
Patterns are shell-style globbing patterns as
|
|
Packit Service |
1d0348 |
documented in
|
|
Packit Service |
1d0348 |
[[tcsh(1)|http://www.freebsd.org/cgi/man.cgi?query=tcsh&sektion=1]].
|
|
Packit Service |
1d0348 |
== OPTIONS ==
|
|
Packit Service |
1d0348 |
Unless specifically stated otherwise, options are applicable in
|
|
Packit Service |
1d0348 |
all operating modes.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''@'''''archive''
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
The specified archive is opened and the entries
|
|
Packit Service |
1d0348 |
in it will be appended to the current archive.
|
|
Packit Service |
1d0348 |
As a simple example,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -c -f - newfile @original.tar
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
writes a new archive to standard output containing a file
|
|
Packit Service |
1d0348 |
''newfile''
|
|
Packit Service |
1d0348 |
and all of the entries from
|
|
Packit Service |
1d0348 |
''original.tar''.
|
|
Packit Service |
1d0348 |
In contrast,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -c -f - newfile original.tar
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
creates a new archive with only two entries.
|
|
Packit Service |
1d0348 |
Similarly,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -czf - --format pax @-
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
reads an archive from standard input (whose format will be determined
|
|
Packit Service |
1d0348 |
automatically) and converts it into a gzip-compressed
|
|
Packit Service |
1d0348 |
pax-format archive on stdout.
|
|
Packit Service |
1d0348 |
In this way,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
can be used to convert archives from one format to another.
|
|
Packit Service |
1d0348 |
-a, --auto-compress
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Use the archive suffix to decide a set of the format and
|
|
Packit Service |
1d0348 |
the compressions.
|
|
Packit Service |
1d0348 |
As a simple example,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -a -cf archive.tgz source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
creates a new archive with restricted pax format and gzip compression,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -a -cf archive.tar.bz2.uu source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
creates a new archive with restricted pax format and bzip2 compression
|
|
Packit Service |
1d0348 |
and uuencode compression,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -a -cf archive.zip source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
creates a new archive with zip format,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -a -jcf archive.tgz source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
ignores the
|
|
Packit Service |
1d0348 |
"-j"
|
|
Packit Service |
1d0348 |
option, and creates a new archive with restricted pax format
|
|
Packit Service |
1d0348 |
and gzip compression,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -a -jcf archive.xxx source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
if it is unknown suffix or no suffix, creates a new archive with
|
|
Packit Service |
1d0348 |
restricted pax format and bzip2 compression.
|
|
Packit Service |
1d0348 |
--acls
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of
|
|
Packit Service |
1d0348 |
--no-acls
|
|
Packit Service |
1d0348 |
and the default behavior in c, r, and u modes (except on Mac OS X) or if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run in x mode as root. On Mac OS X this option translates extended ACLs
|
|
Packit Service |
1d0348 |
to NFSv4 ACLs. To store extended ACLs the
|
|
Packit Service |
1d0348 |
--mac-metadata
|
|
Packit Service |
1d0348 |
option is preferred.
|
|
Packit Service |
1d0348 |
-B, --read-full-blocks
|
|
Packit Service |
1d0348 |
Ignored for compatibility with other
|
|
Packit Service |
1d0348 |
[[ManPageBsdtar1]]
|
|
Packit Service |
1d0348 |
implementations.
|
|
Packit Service |
1d0348 |
-b ''blocksize'', --block-size ''blocksize''
|
|
Packit Service |
1d0348 |
Specify the block size, in 512-byte records, for tape drive I/O.
|
|
Packit Service |
1d0348 |
As a rule, this argument is only needed when reading from or writing
|
|
Packit Service |
1d0348 |
to tape drives, and usually not even then as the default block size of
|
|
Packit Service |
1d0348 |
20 records (10240 bytes) is very common.
|
|
Packit Service |
1d0348 |
-C ''directory'', --cd ''directory'', --directory ''directory''
|
|
Packit Service |
1d0348 |
In c and r mode, this changes the directory before adding
|
|
Packit Service |
1d0348 |
the following files.
|
|
Packit Service |
1d0348 |
In x mode, change directories after opening the archive
|
|
Packit Service |
1d0348 |
but before extracting entries from the archive.
|
|
Packit Service |
1d0348 |
--chroot
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
'''chroot'''()
|
|
Packit Service |
1d0348 |
to the current directory after processing any
|
|
Packit Service |
1d0348 |
-C
|
|
Packit Service |
1d0348 |
options and before extracting any files.
|
|
Packit Service |
1d0348 |
--clear-nochange-fflags
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Before removing file system objects to replace them, clear platform-specific
|
|
Packit Service |
1d0348 |
file flags that might prevent removal.
|
|
Packit Service |
1d0348 |
--exclude ''pattern''
|
|
Packit Service |
1d0348 |
Do not process files or directories that match the
|
|
Packit Service |
1d0348 |
specified pattern.
|
|
Packit Service |
1d0348 |
Note that exclusions take precedence over patterns or filenames
|
|
Packit Service |
1d0348 |
specified on the command line.
|
|
Packit Service |
1d0348 |
--fflags
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Archive or extract file flags. This is the reverse of
|
|
Packit Service |
1d0348 |
--no-fflags
|
|
Packit Service |
1d0348 |
and the default behavior in c, r, and u modes or if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run in x mode as root.
|
|
Packit Service |
1d0348 |
--format ''format''
|
|
Packit Service |
1d0348 |
(c, r, u mode only)
|
|
Packit Service |
1d0348 |
Use the specified format for the created archive.
|
|
Packit Service |
1d0348 |
Supported formats include
|
|
Packit Service |
1d0348 |
"cpio",
|
|
Packit Service |
1d0348 |
"pax",
|
|
Packit Service |
1d0348 |
"shar",
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
"ustar".
|
|
Packit Service |
1d0348 |
Other formats may also be supported; see
|
|
Packit Service |
1d0348 |
[[ManPageibarchiveormats5]]
|
|
Packit Service |
1d0348 |
for more information about currently-supported formats.
|
|
Packit Service |
1d0348 |
In r and u modes, when extending an existing archive, the format specified
|
|
Packit Service |
1d0348 |
here must be compatible with the format of the existing archive on disk.
|
|
Packit Service |
1d0348 |
-f ''file'', --file ''file''
|
|
Packit Service |
1d0348 |
Read the archive from or write the archive to the specified file.
|
|
Packit Service |
1d0348 |
The filename can be
|
|
Packit Service |
1d0348 |
''-''
|
|
Packit Service |
1d0348 |
for standard input or standard output.
|
|
Packit Service |
1d0348 |
The default varies by system;
|
|
Packit Service |
1d0348 |
on
|
|
Packit Service |
1d0348 |
FreeBSD,
|
|
Packit Service |
1d0348 |
the default is
|
|
Packit Service |
1d0348 |
''/dev/sa0'';
|
|
Packit Service |
1d0348 |
on Linux, the default is
|
|
Packit Service |
1d0348 |
''/dev/st0''.
|
|
Packit Service |
1d0348 |
--gid ''id''
|
|
Packit Service |
1d0348 |
Use the provided group id number.
|
|
Packit Service |
1d0348 |
On extract, this overrides the group id in the archive;
|
|
Packit Service |
1d0348 |
the group name in the archive will be ignored.
|
|
Packit Service |
1d0348 |
On create, this overrides the group id read from disk;
|
|
Packit Service |
1d0348 |
if
|
|
Packit Service |
1d0348 |
--gname
|
|
Packit Service |
1d0348 |
is not also specified, the group name will be set to
|
|
Packit Service |
1d0348 |
match the group id.
|
|
Packit Service |
1d0348 |
--gname ''name''
|
|
Packit Service |
1d0348 |
Use the provided group name.
|
|
Packit Service |
1d0348 |
On extract, this overrides the group name in the archive;
|
|
Packit Service |
1d0348 |
if the provided group name does not exist on the system,
|
|
Packit Service |
1d0348 |
the group id
|
|
Packit Service |
1d0348 |
(from the archive or from the
|
|
Packit Service |
1d0348 |
--gid
|
|
Packit Service |
1d0348 |
option)
|
|
Packit Service |
1d0348 |
will be used instead.
|
|
Packit Service |
1d0348 |
On create, this sets the group name that will be stored
|
|
Packit Service |
1d0348 |
in the archive;
|
|
Packit Service |
1d0348 |
the name will not be verified against the system group database.
|
|
Packit Service |
1d0348 |
-H
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
Symbolic links named on the command line will be followed; the
|
|
Packit Service |
1d0348 |
target of the link will be archived, not the link itself.
|
|
Packit Service |
1d0348 |
-h
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
Synonym for
|
|
Packit Service |
1d0348 |
-L.
|
|
Packit Service |
1d0348 |
-I
|
|
Packit Service |
1d0348 |
Synonym for
|
|
Packit Service |
1d0348 |
-T.
|
|
Packit Service |
1d0348 |
--help
|
|
Packit Service |
1d0348 |
Show usage.
|
|
Packit Service |
1d0348 |
--hfsCompression
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Mac OS X specific (v10.6 or later). Compress extracted regular files with HFS+
|
|
Packit Service |
1d0348 |
compression.
|
|
Packit Service |
1d0348 |
--ignore-zeros
|
|
Packit Service |
1d0348 |
An alias of
|
|
Packit Service |
1d0348 |
--options '''read_concatenated_archives'''
|
|
Packit Service |
1d0348 |
for compatibility with GNU tar.
|
|
Packit Service |
1d0348 |
--include ''pattern''
|
|
Packit Service |
1d0348 |
Process only files or directories that match the specified pattern.
|
|
Packit Service |
1d0348 |
Note that exclusions specified with
|
|
Packit Service |
1d0348 |
--exclude
|
|
Packit Service |
1d0348 |
take precedence over inclusions.
|
|
Packit Service |
1d0348 |
If no inclusions are explicitly specified, all entries are processed by
|
|
Packit Service |
1d0348 |
default.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
--include
|
|
Packit Service |
1d0348 |
option is especially useful when filtering archives.
|
|
Packit Service |
1d0348 |
For example, the command
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -c -f new.tar --include='*foo*' @old.tgz
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
creates a new archive
|
|
Packit Service |
1d0348 |
''new.tar''
|
|
Packit Service |
1d0348 |
containing only the entries from
|
|
Packit Service |
1d0348 |
''old.tgz''
|
|
Packit Service |
1d0348 |
containing the string
|
|
Packit Service |
1d0348 |
Sq foo.
|
|
Packit Service |
1d0348 |
-J, --xz
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[xz(1)|http://www.freebsd.org/cgi/man.cgi?query=xz&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes XZ compression automatically when reading archives.
|
|
Packit Service |
1d0348 |
-j, --bzip, --bzip2, --bunzip2
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[bzip2(1)|http://www.freebsd.org/cgi/man.cgi?query=bzip2&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes bzip2 compression automatically when reading
|
|
Packit Service |
1d0348 |
archives.
|
|
Packit Service |
1d0348 |
-k, --keep-old-files
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Do not overwrite existing files.
|
|
Packit Service |
1d0348 |
In particular, if a file appears more than once in an archive,
|
|
Packit Service |
1d0348 |
later copies will not overwrite earlier copies.
|
|
Packit Service |
1d0348 |
--keep-newer-files
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Do not overwrite existing files that are newer than the
|
|
Packit Service |
1d0348 |
versions appearing in the archive being extracted.
|
|
Packit Service |
1d0348 |
-L, --dereference
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
All symbolic links will be followed.
|
|
Packit Service |
1d0348 |
Normally, symbolic links are archived as such.
|
|
Packit Service |
1d0348 |
With this option, the target of the link will be archived instead.
|
|
Packit Service |
1d0348 |
-l, --check-links
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
Issue a warning message unless all links to each file are archived.
|
|
Packit Service |
1d0348 |
--lrzip
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[lrzip(1)|http://www.freebsd.org/cgi/man.cgi?query=lrzip&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes lrzip compression automatically when reading
|
|
Packit Service |
1d0348 |
archives.
|
|
Packit Service |
1d0348 |
--lz4
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the archive with lz4-compatible compression before writing it.
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes lz4 compression automatically when reading archives.
|
|
Packit Service |
1d0348 |
--zstd
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the archive with zstd-compatible compression before writing it.
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes zstd compression automatically when reading archives.
|
|
Packit Service |
1d0348 |
--lzma
|
|
Packit Service |
1d0348 |
(c mode only) Compress the resulting archive with the original LZMA algorithm.
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Use of this option is discouraged and new archives should be created with
|
|
Packit Service |
1d0348 |
--xz
|
|
Packit Service |
1d0348 |
instead.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes LZMA compression automatically when reading archives.
|
|
Packit Service |
1d0348 |
--lzop
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[lzop(1)|http://www.freebsd.org/cgi/man.cgi?query=lzop&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes LZO compression automatically when reading archives.
|
|
Packit Service |
1d0348 |
-m, --modification-time
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Do not extract modification time.
|
|
Packit Service |
1d0348 |
By default, the modification time is set to the time stored in the archive.
|
|
Packit Service |
1d0348 |
--mac-metadata
|
|
Packit Service |
1d0348 |
(c, r, u and x mode only)
|
|
Packit Service |
1d0348 |
Mac OS X specific. Archive or extract extended ACLs and extended attributes
|
|
Packit Service |
1d0348 |
using
|
|
Packit Service |
1d0348 |
[[copyfile(3)|http://www.freebsd.org/cgi/man.cgi?query=copyfile&sektion=3]]
|
|
Packit Service |
1d0348 |
in AppleDouble format. This is the reverse of
|
|
Packit Service |
1d0348 |
--no-mac-metadata.
|
|
Packit Service |
1d0348 |
and the default behavior in c, r, and u modes or if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run in x mode as root.
|
|
Packit Service |
1d0348 |
-n, --norecurse, --no-recursion
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Do not recursively archive the contents of directories.
|
|
Packit Service |
1d0348 |
--newer ''date''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Only include files and directories newer than the specified date.
|
|
Packit Service |
1d0348 |
This compares ctime entries.
|
|
Packit Service |
1d0348 |
--newer-mtime ''date''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
--newer,
|
|
Packit Service |
1d0348 |
except it compares mtime entries instead of ctime entries.
|
|
Packit Service |
1d0348 |
--newer-than ''file''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Only include files and directories newer than the specified file.
|
|
Packit Service |
1d0348 |
This compares ctime entries.
|
|
Packit Service |
1d0348 |
--newer-mtime-than ''file''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
--newer-than,
|
|
Packit Service |
1d0348 |
except it compares mtime entries instead of ctime entries.
|
|
Packit Service |
1d0348 |
--nodump
|
|
Packit Service |
1d0348 |
(c and r modes only)
|
|
Packit Service |
1d0348 |
Honor the nodump file flag by skipping this file.
|
|
Packit Service |
1d0348 |
--nopreserveHFSCompression
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Mac OS X specific (v10.6 or later). Do not compress extracted regular files
|
|
Packit Service |
1d0348 |
which were compressed with HFS+ compression before archived.
|
|
Packit Service |
1d0348 |
By default, compress the regular files again with HFS+ compression.
|
|
Packit Service |
1d0348 |
--null
|
|
Packit Service |
1d0348 |
(use with
|
|
Packit Service |
1d0348 |
-I
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
-T)
|
|
Packit Service |
1d0348 |
Filenames or patterns are separated by null characters,
|
|
Packit Service |
1d0348 |
not by newlines.
|
|
Packit Service |
1d0348 |
This is often used to read filenames output by the
|
|
Packit Service |
1d0348 |
-print0
|
|
Packit Service |
1d0348 |
option to
|
|
Packit Service |
1d0348 |
[[find(1)|http://www.freebsd.org/cgi/man.cgi?query=find&sektion=1]].
|
|
Packit Service |
1d0348 |
--no-acls
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of
|
|
Packit Service |
1d0348 |
--acls
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes).
|
|
Packit Service |
1d0348 |
--no-fflags
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Do not archive or extract file flags. This is the reverse of
|
|
Packit Service |
1d0348 |
--fflags
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root in x mode.
|
|
Packit Service |
1d0348 |
--no-mac-metadata
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Mac OS X specific. Do not archive or extract ACLs and extended attributes using
|
|
Packit Service |
1d0348 |
[[copyfile(3)|http://www.freebsd.org/cgi/man.cgi?query=copyfile&sektion=3]]
|
|
Packit Service |
1d0348 |
in AppleDouble format. This is the reverse of
|
|
Packit Service |
1d0348 |
--mac-metadata.
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root in x mode.
|
|
Packit Service |
1d0348 |
-n, --norecurse, --no-recursion
|
|
Packit Service |
1d0348 |
--no-same-owner
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Do not extract owner and group IDs.
|
|
Packit Service |
1d0348 |
This is the reverse of
|
|
Packit Service |
1d0348 |
--same-owner
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root.
|
|
Packit Service |
1d0348 |
--no-same-permissions
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Do not extract full permissions (SGID, SUID, sticky bit, ACLs,
|
|
Packit Service |
1d0348 |
extended attributes or extended file flags).
|
|
Packit Service |
1d0348 |
This is the reverse of
|
|
Packit Service |
1d0348 |
-p
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root.
|
|
Packit Service |
1d0348 |
--no-xattrs
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Do not archive or extract extended attributes. This is the reverse of
|
|
Packit Service |
1d0348 |
--xattrs
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as non-root in x mode.
|
|
Packit Service |
1d0348 |
--numeric-owner
|
|
Packit Service |
1d0348 |
This is equivalent to
|
|
Packit Service |
1d0348 |
--uname
|
|
Packit Service |
1d0348 |
Qq
|
|
Packit Service |
1d0348 |
--gname
|
|
Packit Service |
1d0348 |
Qq.
|
|
Packit Service |
1d0348 |
On extract, it causes user and group names in the archive
|
|
Packit Service |
1d0348 |
to be ignored in favor of the numeric user and group ids.
|
|
Packit Service |
1d0348 |
On create, it causes user and group names to not be stored
|
|
Packit Service |
1d0348 |
in the archive.
|
|
Packit Service |
1d0348 |
-O, --to-stdout
|
|
Packit Service |
1d0348 |
(x, t modes only)
|
|
Packit Service |
1d0348 |
In extract (-x) mode, files will be written to standard out rather than
|
|
Packit Service |
1d0348 |
being extracted to disk.
|
|
Packit Service |
1d0348 |
In list (-t) mode, the file listing will be written to stderr rather than
|
|
Packit Service |
1d0348 |
the usual stdout.
|
|
Packit Service |
1d0348 |
-o
|
|
Packit Service |
1d0348 |
(x mode)
|
|
Packit Service |
1d0348 |
Use the user and group of the user running the program rather
|
|
Packit Service |
1d0348 |
than those specified in the archive.
|
|
Packit Service |
1d0348 |
Note that this has no significance unless
|
|
Packit Service |
1d0348 |
-p
|
|
Packit Service |
1d0348 |
is specified, and the program is being run by the root user.
|
|
Packit Service |
1d0348 |
In this case, the file modes and flags from
|
|
Packit Service |
1d0348 |
the archive will be restored, but ACLs or owner information in
|
|
Packit Service |
1d0348 |
the archive will be discarded.
|
|
Packit Service |
1d0348 |
-o
|
|
Packit Service |
1d0348 |
(c, r, u mode)
|
|
Packit Service |
1d0348 |
A synonym for
|
|
Packit Service |
1d0348 |
--format ''ustar''
|
|
Packit Service |
1d0348 |
--older ''date''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Only include files and directories older than the specified date.
|
|
Packit Service |
1d0348 |
This compares ctime entries.
|
|
Packit Service |
1d0348 |
--older-mtime ''date''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
--older,
|
|
Packit Service |
1d0348 |
except it compares mtime entries instead of ctime entries.
|
|
Packit Service |
1d0348 |
--older-than ''file''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Only include files and directories older than the specified file.
|
|
Packit Service |
1d0348 |
This compares ctime entries.
|
|
Packit Service |
1d0348 |
--older-mtime-than ''file''
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
Like
|
|
Packit Service |
1d0348 |
--older-than,
|
|
Packit Service |
1d0348 |
except it compares mtime entries instead of ctime entries.
|
|
Packit Service |
1d0348 |
--one-file-system
|
|
Packit Service |
1d0348 |
(c, r, and u modes)
|
|
Packit Service |
1d0348 |
Do not cross mount points.
|
|
Packit Service |
1d0348 |
--options ''options''
|
|
Packit Service |
1d0348 |
Select optional behaviors for particular modules.
|
|
Packit Service |
1d0348 |
The argument is a text string containing comma-separated
|
|
Packit Service |
1d0348 |
keywords and values.
|
|
Packit Service |
1d0348 |
These are passed to the modules that handle particular
|
|
Packit Service |
1d0348 |
formats to control how those formats will behave.
|
|
Packit Service |
1d0348 |
Each option has one of the following forms:
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
''key=value''
|
|
Packit Service |
1d0348 |
The key will be set to the specified value in every module that supports it.
|
|
Packit Service |
1d0348 |
Modules that do not support this key will ignore it.
|
|
Packit Service |
1d0348 |
''key''
|
|
Packit Service |
1d0348 |
The key will be enabled in every module that supports it.
|
|
Packit Service |
1d0348 |
This is equivalent to
|
|
Packit Service |
1d0348 |
''key'''''=1'''.
|
|
Packit Service |
1d0348 |
''!key''
|
|
Packit Service |
1d0348 |
The key will be disabled in every module that supports it.
|
|
Packit Service |
1d0348 |
''module:key=value'', ''module:key'', ''module:!key''
|
|
Packit Service |
1d0348 |
As above, but the corresponding key and value will be provided
|
|
Packit Service |
1d0348 |
only to modules whose name matches
|
|
Packit Service |
1d0348 |
''module''.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The currently supported modules and keys are:
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''iso9660:joliet'''
|
|
Packit Service |
1d0348 |
Support Joliet extensions.
|
|
Packit Service |
1d0348 |
This is enabled by default, use
|
|
Packit Service |
1d0348 |
'''!joliet'''
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
'''iso9660:!joliet'''
|
|
Packit Service |
1d0348 |
to disable.
|
|
Packit Service |
1d0348 |
'''iso9660:rockridge'''
|
|
Packit Service |
1d0348 |
Support Rock Ridge extensions.
|
|
Packit Service |
1d0348 |
This is enabled by default, use
|
|
Packit Service |
1d0348 |
'''!rockridge'''
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
'''iso9660:!rockridge'''
|
|
Packit Service |
1d0348 |
to disable.
|
|
Packit Service |
1d0348 |
'''gzip:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 1 to 9 specifying the gzip compression level.
|
|
Packit Service |
1d0348 |
'''gzip:timestamp'''
|
|
Packit Service |
1d0348 |
Store timestamp. This is enabled by default, use
|
|
Packit Service |
1d0348 |
'''!timestamp'''
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
'''gzip:!timestamp'''
|
|
Packit Service |
1d0348 |
to disable.
|
|
Packit Service |
1d0348 |
'''lrzip:compression'''=''type''
|
|
Packit Service |
1d0348 |
Use
|
|
Packit Service |
1d0348 |
''type''
|
|
Packit Service |
1d0348 |
as compression method.
|
|
Packit Service |
1d0348 |
Supported values are bzip2, gzip, lzo (ultra fast),
|
|
Packit Service |
1d0348 |
and zpaq (best, extremely slow).
|
|
Packit Service |
1d0348 |
'''lrzip:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 1 to 9 specifying the lrzip compression level.
|
|
Packit Service |
1d0348 |
'''lz4:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 1 to 9 specifying the lzop compression level.
|
|
Packit Service |
1d0348 |
'''lz4:stream-checksum'''
|
|
Packit Service |
1d0348 |
Enable stream checksum. This is by default, use
|
|
Packit Service |
1d0348 |
'''lz4:!stream-checksum'''
|
|
Packit Service |
1d0348 |
to disable.
|
|
Packit Service |
1d0348 |
'''lz4:block-checksum'''
|
|
Packit Service |
1d0348 |
Enable block checksum (Disabled by default).
|
|
Packit Service |
1d0348 |
'''lz4:block-size'''
|
|
Packit Service |
1d0348 |
A decimal integer from 4 to 7 specifying the lz4 compression block size
|
|
Packit Service |
1d0348 |
(7 is set by default).
|
|
Packit Service |
1d0348 |
'''lz4:block-dependence'''
|
|
Packit Service |
1d0348 |
Use the previous block of the block being compressed for
|
|
Packit Service |
1d0348 |
a compression dictionary to improve compression ratio.
|
|
Packit Service |
1d0348 |
'''zstd:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 1 to 22 specifying the zstd compression level.
|
|
Packit Service |
1d0348 |
'''lzop:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 1 to 9 specifying the lzop compression level.
|
|
Packit Service |
1d0348 |
'''xz:compression-level'''
|
|
Packit Service |
1d0348 |
A decimal integer from 0 to 9 specifying the xz compression level.
|
|
Packit Service |
1d0348 |
'''mtree:'''''keyword''
|
|
Packit Service |
1d0348 |
The mtree writer module allows you to specify which mtree keywords
|
|
Packit Service |
1d0348 |
will be included in the output.
|
|
Packit Service |
1d0348 |
Supported keywords include:
|
|
Packit Service |
1d0348 |
'''cksum''', '''device''', '''flags''', '''gid''', '''gname''', '''indent''',
|
|
Packit Service |
1d0348 |
'''link''', '''md5''', '''mode''', '''nlink''', '''rmd160''', '''sha1''', '''sha256''',
|
|
Packit Service |
1d0348 |
'''sha384''', '''sha512''', '''size''', '''time''', '''uid''', '''uname'''.
|
|
Packit Service |
1d0348 |
The default is equivalent to:
|
|
Packit Service |
1d0348 |
"device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname".
|
|
Packit Service |
1d0348 |
'''mtree:all'''
|
|
Packit Service |
1d0348 |
Enables all of the above keywords.
|
|
Packit Service |
1d0348 |
You can also use
|
|
Packit Service |
1d0348 |
'''mtree:!all'''
|
|
Packit Service |
1d0348 |
to disable all keywords.
|
|
Packit Service |
1d0348 |
'''mtree:use-set'''
|
|
Packit Service |
1d0348 |
Enable generation of
|
|
Packit Service |
1d0348 |
'''/set'''
|
|
Packit Service |
1d0348 |
lines in the output.
|
|
Packit Service |
1d0348 |
'''mtree:indent'''
|
|
Packit Service |
1d0348 |
Produce human-readable output by indenting options and splitting lines
|
|
Packit Service |
1d0348 |
to fit into 80 columns.
|
|
Packit Service |
1d0348 |
'''zip:compression'''=''type''
|
|
Packit Service |
1d0348 |
Use
|
|
Packit Service |
1d0348 |
''type''
|
|
Packit Service |
1d0348 |
as compression method.
|
|
Packit Service |
1d0348 |
Supported values are store (uncompressed) and deflate (gzip algorithm).
|
|
Packit Service |
1d0348 |
'''zip:encryption'''
|
|
Packit Service |
1d0348 |
Enable encryption using traditional zip encryption.
|
|
Packit Service |
1d0348 |
'''zip:encryption'''=''type''
|
|
Packit Service |
1d0348 |
Use
|
|
Packit Service |
1d0348 |
''type''
|
|
Packit Service |
1d0348 |
as encryption type.
|
|
Packit Service |
1d0348 |
Supported values are zipcrypt (traditional zip encryption),
|
|
Packit Service |
1d0348 |
aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryption).
|
|
Packit Service |
1d0348 |
'''read_concatenated_archives'''
|
|
Packit Service |
1d0348 |
Ignore zeroed blocks in the archive, which occurs when multiple tar archives
|
|
Packit Service |
1d0348 |
have been concatenated together. Without this option, only the contents of
|
|
Packit Service |
1d0348 |
the first concatenated archive would be read. This option is comparable to
|
|
Packit Service |
1d0348 |
the
|
|
Packit Service |
1d0348 |
-i, --ignore-zeros
|
|
Packit Service |
1d0348 |
option of GNU tar.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
If a provided option is not supported by any module, that
|
|
Packit Service |
1d0348 |
is a fatal error.
|
|
Packit Service |
1d0348 |
-P, --absolute-paths
|
|
Packit Service |
1d0348 |
Preserve pathnames.
|
|
Packit Service |
1d0348 |
By default, absolute pathnames (those that begin with a /
|
|
Packit Service |
1d0348 |
character) have the leading slash removed both when creating archives
|
|
Packit Service |
1d0348 |
and extracting from them.
|
|
Packit Service |
1d0348 |
Also,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will refuse to extract archive entries whose pathnames contain
|
|
Packit Service |
1d0348 |
''..''
|
|
Packit Service |
1d0348 |
or whose target directory would be altered by a symlink.
|
|
Packit Service |
1d0348 |
This option suppresses these behaviors.
|
|
Packit Service |
1d0348 |
-p, --insecure, --preserve-permissions
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Preserve file permissions.
|
|
Packit Service |
1d0348 |
Attempt to restore the full permissions, including owner, file modes, ACLs,
|
|
Packit Service |
1d0348 |
extended attributes and extended file flags, if available, for each item
|
|
Packit Service |
1d0348 |
extracted from the archive. This is te reverse of
|
|
Packit Service |
1d0348 |
--no-same-permissions
|
|
Packit Service |
1d0348 |
and the default if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is being run by root and can be partially overridden by also specifying
|
|
Packit Service |
1d0348 |
--no-acls,
|
|
Packit Service |
1d0348 |
--no-fflags,
|
|
Packit Service |
1d0348 |
--no-mac-metadata
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
--no-xattrs.
|
|
Packit Service |
1d0348 |
--passphrase ''passphrase''
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
''passphrase''
|
|
Packit Service |
1d0348 |
is used to extract or create an encrypted archive.
|
|
Packit Service |
1d0348 |
Currently, zip is the only supported format that supports encryption.
|
|
Packit Service |
1d0348 |
You shouldn't use this option unless you realize how insecure
|
|
Packit Service |
1d0348 |
use of this option is.
|
|
Packit Service |
1d0348 |
--posix
|
|
Packit Service |
1d0348 |
(c, r, u mode only)
|
|
Packit Service |
1d0348 |
Synonym for
|
|
Packit Service |
1d0348 |
--format ''pax''
|
|
Packit Service |
1d0348 |
-q, --fast-read
|
|
Packit Service |
1d0348 |
(x and t mode only)
|
|
Packit Service |
1d0348 |
Extract or list only the first archive entry that matches each pattern
|
|
Packit Service |
1d0348 |
or filename operand.
|
|
Packit Service |
1d0348 |
Exit as soon as each specified pattern or filename has been matched.
|
|
Packit Service |
1d0348 |
By default, the archive is always read to the very end, since
|
|
Packit Service |
1d0348 |
there can be multiple entries with the same name and, by convention,
|
|
Packit Service |
1d0348 |
later entries overwrite earlier entries.
|
|
Packit Service |
1d0348 |
This option is provided as a performance optimization.
|
|
Packit Service |
1d0348 |
-S
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Extract files as sparse files.
|
|
Packit Service |
1d0348 |
For every block on disk, check first if it contains only NULL bytes and seek
|
|
Packit Service |
1d0348 |
over it otherwise.
|
|
Packit Service |
1d0348 |
This works similar to the conv=sparse option of dd.
|
|
Packit Service |
1d0348 |
-s ''pattern''
|
|
Packit Service |
1d0348 |
Modify file or archive member names according to
|
|
Packit Service |
1d0348 |
''pattern''.
|
|
Packit Service |
1d0348 |
The pattern has the format
|
|
Packit Service |
1d0348 |
''/old/new/''<nowiki>[</nowiki>ghHprRsS<nowiki>]</nowiki>
|
|
Packit Service |
1d0348 |
where
|
|
Packit Service |
1d0348 |
''old''
|
|
Packit Service |
1d0348 |
is a basic regular expression,
|
|
Packit Service |
1d0348 |
''new''
|
|
Packit Service |
1d0348 |
is the replacement string of the matched part,
|
|
Packit Service |
1d0348 |
and the optional trailing letters modify
|
|
Packit Service |
1d0348 |
how the replacement is handled.
|
|
Packit Service |
1d0348 |
If
|
|
Packit Service |
1d0348 |
''old''
|
|
Packit Service |
1d0348 |
is not matched, the pattern is skipped.
|
|
Packit Service |
1d0348 |
Within
|
|
Packit Service |
1d0348 |
''new'',
|
|
Packit Service |
1d0348 |
~ is substituted with the match, \e1 to \e9 with the content of
|
|
Packit Service |
1d0348 |
the corresponding captured group.
|
|
Packit Service |
1d0348 |
The optional trailing g specifies that matching should continue
|
|
Packit Service |
1d0348 |
after the matched part and stop on the first unmatched pattern.
|
|
Packit Service |
1d0348 |
The optional trailing s specifies that the pattern applies to the value
|
|
Packit Service |
1d0348 |
of symbolic links.
|
|
Packit Service |
1d0348 |
The optional trailing p specifies that after a successful substitution
|
|
Packit Service |
1d0348 |
the original path name and the new path name should be printed to
|
|
Packit Service |
1d0348 |
standard error.
|
|
Packit Service |
1d0348 |
Optional trailing H, R, or S characters suppress substitutions
|
|
Packit Service |
1d0348 |
for hardlink targets, regular filenames, or symlink targets,
|
|
Packit Service |
1d0348 |
respectively.
|
|
Packit Service |
1d0348 |
Optional trailing h, r, or s characters enable substitutions
|
|
Packit Service |
1d0348 |
for hardlink targets, regular filenames, or symlink targets,
|
|
Packit Service |
1d0348 |
respectively.
|
|
Packit Service |
1d0348 |
The default is
|
|
Packit Service |
1d0348 |
''hrs''
|
|
Packit Service |
1d0348 |
which applies substitutions to all names.
|
|
Packit Service |
1d0348 |
In particular, it is never necessary to specify h, r, or s.
|
|
Packit Service |
1d0348 |
--same-owner
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Extract owner and group IDs.
|
|
Packit Service |
1d0348 |
This is the reverse of
|
|
Packit Service |
1d0348 |
--no-same-owner
|
|
Packit Service |
1d0348 |
and the default behavior if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run as root.
|
|
Packit Service |
1d0348 |
--strip-components ''count''
|
|
Packit Service |
1d0348 |
Remove the specified number of leading path elements.
|
|
Packit Service |
1d0348 |
Pathnames with fewer elements will be silently skipped.
|
|
Packit Service |
1d0348 |
Note that the pathname is edited after checking inclusion/exclusion patterns
|
|
Packit Service |
1d0348 |
but before security checks.
|
|
Packit Service |
1d0348 |
-T ''filename'', --files-from ''filename''
|
|
Packit Service |
1d0348 |
In x or t mode,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will read the list of names to be extracted from
|
|
Packit Service |
1d0348 |
''filename''.
|
|
Packit Service |
1d0348 |
In c mode,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will read names to be archived from
|
|
Packit Service |
1d0348 |
''filename''.
|
|
Packit Service |
1d0348 |
The special name
|
|
Packit Service |
1d0348 |
"-C"
|
|
Packit Service |
1d0348 |
on a line by itself will cause the current directory to be changed to
|
|
Packit Service |
1d0348 |
the directory specified on the following line.
|
|
Packit Service |
1d0348 |
Names are terminated by newlines unless
|
|
Packit Service |
1d0348 |
--null
|
|
Packit Service |
1d0348 |
is specified.
|
|
Packit Service |
1d0348 |
Note that
|
|
Packit Service |
1d0348 |
--null
|
|
Packit Service |
1d0348 |
also disables the special handling of lines containing
|
|
Packit Service |
1d0348 |
"-C".
|
|
Packit Service |
1d0348 |
Note: If you are generating lists of files using
|
|
Packit Service |
1d0348 |
[[find(1)|http://www.freebsd.org/cgi/man.cgi?query=find&sektion=1]],
|
|
Packit Service |
1d0348 |
you probably want to use
|
|
Packit Service |
1d0348 |
-n
|
|
Packit Service |
1d0348 |
as well.
|
|
Packit Service |
1d0348 |
--totals
|
|
Packit Service |
1d0348 |
(c, r, u modes only)
|
|
Packit Service |
1d0348 |
After archiving all files, print a summary to stderr.
|
|
Packit Service |
1d0348 |
-U, --unlink, --unlink-first
|
|
Packit Service |
1d0348 |
(x mode only)
|
|
Packit Service |
1d0348 |
Unlink files before creating them.
|
|
Packit Service |
1d0348 |
This can be a minor performance optimization if most files
|
|
Packit Service |
1d0348 |
already exist, but can make things slower if most files
|
|
Packit Service |
1d0348 |
do not already exist.
|
|
Packit Service |
1d0348 |
This flag also causes
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
to remove intervening directory symlinks instead of
|
|
Packit Service |
1d0348 |
reporting an error.
|
|
Packit Service |
1d0348 |
See the SECURITY section below for more details.
|
|
Packit Service |
1d0348 |
--uid ''id''
|
|
Packit Service |
1d0348 |
Use the provided user id number and ignore the user
|
|
Packit Service |
1d0348 |
name from the archive.
|
|
Packit Service |
1d0348 |
On create, if
|
|
Packit Service |
1d0348 |
--uname
|
|
Packit Service |
1d0348 |
is not also specified, the user name will be set to
|
|
Packit Service |
1d0348 |
match the user id.
|
|
Packit Service |
1d0348 |
--uname ''name''
|
|
Packit Service |
1d0348 |
Use the provided user name.
|
|
Packit Service |
1d0348 |
On extract, this overrides the user name in the archive;
|
|
Packit Service |
1d0348 |
if the provided user name does not exist on the system,
|
|
Packit Service |
1d0348 |
it will be ignored and the user id
|
|
Packit Service |
1d0348 |
(from the archive or from the
|
|
Packit Service |
1d0348 |
--uid
|
|
Packit Service |
1d0348 |
option)
|
|
Packit Service |
1d0348 |
will be used instead.
|
|
Packit Service |
1d0348 |
On create, this sets the user name that will be stored
|
|
Packit Service |
1d0348 |
in the archive;
|
|
Packit Service |
1d0348 |
the name is not verified against the system user database.
|
|
Packit Service |
1d0348 |
--use-compress-program ''program''
|
|
Packit Service |
1d0348 |
Pipe the input (in x or t mode) or the output (in c mode) through
|
|
Packit Service |
1d0348 |
''program''
|
|
Packit Service |
1d0348 |
instead of using the builtin compression support.
|
|
Packit Service |
1d0348 |
-v, --verbose
|
|
Packit Service |
1d0348 |
Produce verbose output.
|
|
Packit Service |
1d0348 |
In create and extract modes,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will list each file name as it is read from or written to
|
|
Packit Service |
1d0348 |
the archive.
|
|
Packit Service |
1d0348 |
In list mode,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will produce output similar to that of
|
|
Packit Service |
1d0348 |
[[ls(1)|http://www.freebsd.org/cgi/man.cgi?query=ls&sektion=1]].
|
|
Packit Service |
1d0348 |
An additional
|
|
Packit Service |
1d0348 |
-v
|
|
Packit Service |
1d0348 |
option will also provide ls-like details in create and extract mode.
|
|
Packit Service |
1d0348 |
--version
|
|
Packit Service |
1d0348 |
Print version of
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''libarchive''',
|
|
Packit Service |
1d0348 |
and exit.
|
|
Packit Service |
1d0348 |
-w, --confirmation, --interactive
|
|
Packit Service |
1d0348 |
Ask for confirmation for every action.
|
|
Packit Service |
1d0348 |
-X ''filename'', --exclude-from ''filename''
|
|
Packit Service |
1d0348 |
Read a list of exclusion patterns from the specified file.
|
|
Packit Service |
1d0348 |
See
|
|
Packit Service |
1d0348 |
--exclude
|
|
Packit Service |
1d0348 |
for more information about the handling of exclusions.
|
|
Packit Service |
1d0348 |
--xattrs
|
|
Packit Service |
1d0348 |
(c, r, u, x modes only)
|
|
Packit Service |
1d0348 |
Archive or extract extended attributes. This is the reverse of
|
|
Packit Service |
1d0348 |
--no-xattrs
|
|
Packit Service |
1d0348 |
and the default behavior in c, r, and u modes or if
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
is run in x mode as root.
|
|
Packit Service |
1d0348 |
-y
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[bzip2(1)|http://www.freebsd.org/cgi/man.cgi?query=bzip2&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes bzip2 compression automatically when reading
|
|
Packit Service |
1d0348 |
archives.
|
|
Packit Service |
1d0348 |
-Z, --compress, --uncompress
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[compress(1)|http://www.freebsd.org/cgi/man.cgi?query=compress&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes compress compression automatically when reading
|
|
Packit Service |
1d0348 |
archives.
|
|
Packit Service |
1d0348 |
-z, --gunzip, --gzip
|
|
Packit Service |
1d0348 |
(c mode only)
|
|
Packit Service |
1d0348 |
Compress the resulting archive with
|
|
Packit Service |
1d0348 |
[[gzip(1)|http://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1]].
|
|
Packit Service |
1d0348 |
In extract or list modes, this option is ignored.
|
|
Packit Service |
1d0348 |
Note that this
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
implementation recognizes gzip compression automatically when reading
|
|
Packit Service |
1d0348 |
archives.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
== ENVIRONMENT ==
|
|
Packit Service |
1d0348 |
The following environment variables affect the execution of
|
|
Packit Service |
1d0348 |
'''tar''':
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
'''TAR_READER_OPTIONS'''
|
|
Packit Service |
1d0348 |
The default options for format readers and compression readers.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
--options
|
|
Packit Service |
1d0348 |
option overrides this.
|
|
Packit Service |
1d0348 |
'''TAR_WRITER_OPTIONS'''
|
|
Packit Service |
1d0348 |
The default options for format writers and compression writers.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
--options
|
|
Packit Service |
1d0348 |
option overrides this.
|
|
Packit Service |
1d0348 |
'''LANG'''
|
|
Packit Service |
1d0348 |
The locale to use.
|
|
Packit Service |
1d0348 |
See
|
|
Packit Service |
1d0348 |
[[environ(7)|http://www.freebsd.org/cgi/man.cgi?query=environ&sektion=7]]
|
|
Packit Service |
1d0348 |
for more information.
|
|
Packit Service |
1d0348 |
'''TAPE'''
|
|
Packit Service |
1d0348 |
The default device.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
-f
|
|
Packit Service |
1d0348 |
option overrides this.
|
|
Packit Service |
1d0348 |
Please see the description of the
|
|
Packit Service |
1d0348 |
-f
|
|
Packit Service |
1d0348 |
option above for more details.
|
|
Packit Service |
1d0348 |
'''TZ'''
|
|
Packit Service |
1d0348 |
The timezone to use when displaying dates.
|
|
Packit Service |
1d0348 |
See
|
|
Packit Service |
1d0348 |
[[environ(7)|http://www.freebsd.org/cgi/man.cgi?query=environ&sektion=7]]
|
|
Packit Service |
1d0348 |
for more information.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
== EXIT STATUS ==
|
|
Packit Service |
1d0348 |
The '''tar''' utility exits 0 on success, and >0 if an error occurs.
|
|
Packit Service |
1d0348 |
== EXAMPLES ==
|
|
Packit Service |
1d0348 |
The following creates a new archive
|
|
Packit Service |
1d0348 |
called
|
|
Packit Service |
1d0348 |
''file.tar.gz''
|
|
Packit Service |
1d0348 |
that contains two files
|
|
Packit Service |
1d0348 |
''source.c''
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
''source.h'':
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -czf file.tar.gz source.c source.h
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To view a detailed table of contents for this
|
|
Packit Service |
1d0348 |
archive:
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -tvf file.tar.gz
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To extract all entries from the archive on
|
|
Packit Service |
1d0348 |
the default tape drive:
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -x
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To examine the contents of an ISO 9660 cdrom image:
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -tf image.iso
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To move file hierarchies, invoke
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
as
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -cf - -C srcdir\. | tar -xpf - -C destdir
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
or more traditionally
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
cd srcdir ; tar -cf -\. | (cd destdir ; tar -xpf -)
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
In create mode, the list of files and directories to be archived
|
|
Packit Service |
1d0348 |
can also include directory change instructions of the form
|
|
Packit Service |
1d0348 |
'''-C'''''foo/baz''
|
|
Packit Service |
1d0348 |
and archive inclusions of the form
|
|
Packit Service |
1d0348 |
'''@'''''archive-file''.
|
|
Packit Service |
1d0348 |
For example, the command line
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
will create a new archive
|
|
Packit Service |
1d0348 |
''new.tar''.
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will read the file
|
|
Packit Service |
1d0348 |
''foo1''
|
|
Packit Service |
1d0348 |
from the current directory and add it to the output archive.
|
|
Packit Service |
1d0348 |
It will then read each entry from
|
|
Packit Service |
1d0348 |
''old.tgz''
|
|
Packit Service |
1d0348 |
and add those entries to the output archive.
|
|
Packit Service |
1d0348 |
Finally, it will switch to the
|
|
Packit Service |
1d0348 |
''/tmp''
|
|
Packit Service |
1d0348 |
directory and add
|
|
Packit Service |
1d0348 |
''foo2''
|
|
Packit Service |
1d0348 |
to the output archive.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
An input file in
|
|
Packit Service |
1d0348 |
[[ManPageMtree5]]
|
|
Packit Service |
1d0348 |
format can be used to create an output archive with arbitrary ownership,
|
|
Packit Service |
1d0348 |
permissions, or names that differ from existing data on disk:
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
$ cat input.mtree
|
|
Packit Service |
1d0348 |
#mtree
|
|
Packit Service |
1d0348 |
usr/bin uid=0 gid=0 mode=0755 type=dir
|
|
Packit Service |
1d0348 |
usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
|
|
Packit Service |
1d0348 |
$ tar -cvf output.tar @input.mtree
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
--newer
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
--newer-mtime
|
|
Packit Service |
1d0348 |
switches accept a variety of common date and time specifications, including
|
|
Packit Service |
1d0348 |
"12 Mar 2005 7:14:29pm",
|
|
Packit Service |
1d0348 |
"2005-03-12 19:14",
|
|
Packit Service |
1d0348 |
"5 minutes ago",
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
"19:14 PST May 1".
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
--options
|
|
Packit Service |
1d0348 |
argument can be used to control various details of archive generation
|
|
Packit Service |
1d0348 |
or reading.
|
|
Packit Service |
1d0348 |
For example, you can generate mtree output which only contains
|
|
Packit Service |
1d0348 |
'''type''', '''time''',
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''uid'''
|
|
Packit Service |
1d0348 |
keywords:
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
or you can set the compression level used by gzip or xz compression:
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -czf file.tar --options='compression-level=9'.
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
For more details, see the explanation of the
|
|
Packit Service |
1d0348 |
'''archive_read_set_options'''()
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''archive_write_set_options'''()
|
|
Packit Service |
1d0348 |
API calls that are described in
|
|
Packit Service |
1d0348 |
[[ManPagerchiveead3]]
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
[[ManPagerchiverite3]].
|
|
Packit Service |
1d0348 |
== COMPATIBILITY ==
|
|
Packit Service |
1d0348 |
The bundled-arguments format is supported for compatibility
|
|
Packit Service |
1d0348 |
with historic implementations.
|
|
Packit Service |
1d0348 |
It consists of an initial word (with no leading - character) in which
|
|
Packit Service |
1d0348 |
each character indicates an option.
|
|
Packit Service |
1d0348 |
Arguments follow as separate words.
|
|
Packit Service |
1d0348 |
The order of the arguments must match the order
|
|
Packit Service |
1d0348 |
of the corresponding characters in the bundled command word.
|
|
Packit Service |
1d0348 |
For example,
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar tbf 32 file.tar
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
specifies three flags
|
|
Packit Service |
1d0348 |
'''t''',
|
|
Packit Service |
1d0348 |
'''b''',
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''f'''.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
'''b'''
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''f'''
|
|
Packit Service |
1d0348 |
flags both require arguments,
|
|
Packit Service |
1d0348 |
so there must be two additional items
|
|
Packit Service |
1d0348 |
on the command line.
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
''32''
|
|
Packit Service |
1d0348 |
is the argument to the
|
|
Packit Service |
1d0348 |
'''b'''
|
|
Packit Service |
1d0348 |
flag, and
|
|
Packit Service |
1d0348 |
''file.tar''
|
|
Packit Service |
1d0348 |
is the argument to the
|
|
Packit Service |
1d0348 |
'''f'''
|
|
Packit Service |
1d0348 |
flag.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The mode options c, r, t, u, and x and the options
|
|
Packit Service |
1d0348 |
b, f, l, m, o, v, and w comply with SUSv2.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
For maximum portability, scripts that invoke
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
should use the bundled-argument format above, should limit
|
|
Packit Service |
1d0348 |
themselves to the
|
|
Packit Service |
1d0348 |
'''c''',
|
|
Packit Service |
1d0348 |
'''t''',
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''x'''
|
|
Packit Service |
1d0348 |
modes, and the
|
|
Packit Service |
1d0348 |
'''b''',
|
|
Packit Service |
1d0348 |
'''f''',
|
|
Packit Service |
1d0348 |
'''m''',
|
|
Packit Service |
1d0348 |
'''v''',
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''w'''
|
|
Packit Service |
1d0348 |
options.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
Additional long options are provided to improve compatibility with other
|
|
Packit Service |
1d0348 |
tar implementations.
|
|
Packit Service |
1d0348 |
== SECURITY ==
|
|
Packit Service |
1d0348 |
Certain security issues are common to many archiving programs, including
|
|
Packit Service |
1d0348 |
'''tar'''.
|
|
Packit Service |
1d0348 |
In particular, carefully-crafted archives can request that
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
extract files to locations outside of the target directory.
|
|
Packit Service |
1d0348 |
This can potentially be used to cause unwitting users to overwrite
|
|
Packit Service |
1d0348 |
files they did not intend to overwrite.
|
|
Packit Service |
1d0348 |
If the archive is being extracted by the superuser, any file
|
|
Packit Service |
1d0348 |
on the system can potentially be overwritten.
|
|
Packit Service |
1d0348 |
There are three ways this can happen.
|
|
Packit Service |
1d0348 |
Although
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
has mechanisms to protect against each one,
|
|
Packit Service |
1d0348 |
savvy users should be aware of the implications:
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
Archive entries can have absolute pathnames.
|
|
Packit Service |
1d0348 |
By default,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
removes the leading
|
|
Packit Service |
1d0348 |
''/''
|
|
Packit Service |
1d0348 |
character from filenames before restoring them to guard against this problem.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
Archive entries can have pathnames that include
|
|
Packit Service |
1d0348 |
''..''
|
|
Packit Service |
1d0348 |
components.
|
|
Packit Service |
1d0348 |
By default,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will not extract files containing
|
|
Packit Service |
1d0348 |
''..''
|
|
Packit Service |
1d0348 |
components in their pathname.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
Archive entries can exploit symbolic links to restore
|
|
Packit Service |
1d0348 |
files to other directories.
|
|
Packit Service |
1d0348 |
An archive can restore a symbolic link to another directory,
|
|
Packit Service |
1d0348 |
then use that link to restore a file into that directory.
|
|
Packit Service |
1d0348 |
To guard against this,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
checks each extracted path for symlinks.
|
|
Packit Service |
1d0348 |
If the final path element is a symlink, it will be removed
|
|
Packit Service |
1d0348 |
and replaced with the archive entry.
|
|
Packit Service |
1d0348 |
If
|
|
Packit Service |
1d0348 |
-U
|
|
Packit Service |
1d0348 |
is specified, any intermediate symlink will also be unconditionally removed.
|
|
Packit Service |
1d0348 |
If neither
|
|
Packit Service |
1d0348 |
-U
|
|
Packit Service |
1d0348 |
nor
|
|
Packit Service |
1d0348 |
-P
|
|
Packit Service |
1d0348 |
is specified,
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will refuse to extract the entry.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To protect yourself, you should be wary of any archives that
|
|
Packit Service |
1d0348 |
come from untrusted sources.
|
|
Packit Service |
1d0348 |
You should examine the contents of an archive with
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -tf filename
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
before extraction.
|
|
Packit Service |
1d0348 |
You should use the
|
|
Packit Service |
1d0348 |
-k
|
|
Packit Service |
1d0348 |
option to ensure that
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
will not overwrite any existing files or the
|
|
Packit Service |
1d0348 |
-U
|
|
Packit Service |
1d0348 |
option to remove any pre-existing files.
|
|
Packit Service |
1d0348 |
You should generally not extract archives while running with super-user
|
|
Packit Service |
1d0348 |
privileges.
|
|
Packit Service |
1d0348 |
Note that the
|
|
Packit Service |
1d0348 |
-P
|
|
Packit Service |
1d0348 |
option to
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
disables the security checks above and allows you to extract
|
|
Packit Service |
1d0348 |
an archive while preserving any absolute pathnames,
|
|
Packit Service |
1d0348 |
''..''
|
|
Packit Service |
1d0348 |
components, or symlinks to other directories.
|
|
Packit Service |
1d0348 |
== SEE ALSO ==
|
|
Packit Service |
1d0348 |
[[bzip2(1)|http://www.freebsd.org/cgi/man.cgi?query=bzip2&sektion=1]],
|
|
Packit Service |
1d0348 |
[[compress(1)|http://www.freebsd.org/cgi/man.cgi?query=compress&sektion=1]],
|
|
Packit Service |
1d0348 |
[[ManPageBsdcpio1]],
|
|
Packit Service |
1d0348 |
[[gzip(1)|http://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1]],
|
|
Packit Service |
1d0348 |
[[mt(1)|http://www.freebsd.org/cgi/man.cgi?query=mt&sektion=1]],
|
|
Packit Service |
1d0348 |
[[pax(1)|http://www.freebsd.org/cgi/man.cgi?query=pax&sektion=1]],
|
|
Packit Service |
1d0348 |
[[shar(1)|http://www.freebsd.org/cgi/man.cgi?query=shar&sektion=1]],
|
|
Packit Service |
1d0348 |
[[xz(1)|http://www.freebsd.org/cgi/man.cgi?query=xz&sektion=1]],
|
|
Packit Service |
1d0348 |
[[ManPageibarchive3]],
|
|
Packit Service |
1d0348 |
[[ManPageibarchiveormats5]],
|
|
Packit Service |
1d0348 |
[[ManPageTar5]]
|
|
Packit Service |
1d0348 |
== STANDARDS ==
|
|
Packit Service |
1d0348 |
There is no current POSIX standard for the tar command; it appeared
|
|
Packit Service |
1d0348 |
in
|
|
Packit Service |
1d0348 |
<nowiki>ISO/IEC 9945-1:1996 (``POSIX.1'')</nowiki>
|
|
Packit Service |
1d0348 |
but was dropped from
|
|
Packit Service |
1d0348 |
<nowiki>IEEE Std 1003.1-2001 (``POSIX.1'')</nowiki>.
|
|
Packit Service |
1d0348 |
The options supported by this implementation were developed by surveying a
|
|
Packit Service |
1d0348 |
number of existing tar implementations as well as the old POSIX specification
|
|
Packit Service |
1d0348 |
for tar and the current POSIX specification for pax.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The ustar and pax interchange file formats are defined by
|
|
Packit Service |
1d0348 |
<nowiki>IEEE Std 1003.1-2001 (``POSIX.1'')</nowiki>
|
|
Packit Service |
1d0348 |
for the pax command.
|
|
Packit Service |
1d0348 |
== HISTORY ==
|
|
Packit Service |
1d0348 |
A
|
|
Packit Service |
1d0348 |
'''tar'''
|
|
Packit Service |
1d0348 |
command appeared in Seventh Edition Unix, which was released in January, 1979.
|
|
Packit Service |
1d0348 |
There have been numerous other implementations,
|
|
Packit Service |
1d0348 |
many of which extended the file format.
|
|
Packit Service |
1d0348 |
John Gilmore's
|
|
Packit Service |
1d0348 |
'''pdtar'''
|
|
Packit Service |
1d0348 |
public-domain implementation (circa November, 1987)
|
|
Packit Service |
1d0348 |
was quite influential, and formed the basis of GNU tar.
|
|
Packit Service |
1d0348 |
GNU tar was included as the standard system tar
|
|
Packit Service |
1d0348 |
in
|
|
Packit Service |
1d0348 |
FreeBSD
|
|
Packit Service |
1d0348 |
beginning with
|
|
Packit Service |
1d0348 |
FreeBSD 1.0.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
This is a complete re-implementation based on the
|
|
Packit Service |
1d0348 |
[[ManPageibarchive3]]
|
|
Packit Service |
1d0348 |
library.
|
|
Packit Service |
1d0348 |
It was first released with
|
|
Packit Service |
1d0348 |
FreeBSD 5.4
|
|
Packit Service |
1d0348 |
in May, 2005.
|
|
Packit Service |
1d0348 |
== BUGS ==
|
|
Packit Service |
1d0348 |
This program follows
|
|
Packit Service |
1d0348 |
<nowiki>ISO/IEC 9945-1:1996 (``POSIX.1'')</nowiki>
|
|
Packit Service |
1d0348 |
for the definition of the
|
|
Packit Service |
1d0348 |
-l
|
|
Packit Service |
1d0348 |
option.
|
|
Packit Service |
1d0348 |
Note that GNU tar prior to version 1.15 treated
|
|
Packit Service |
1d0348 |
-l
|
|
Packit Service |
1d0348 |
as a synonym for the
|
|
Packit Service |
1d0348 |
--one-file-system
|
|
Packit Service |
1d0348 |
option.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
-C ''dir''
|
|
Packit Service |
1d0348 |
option may differ from historic implementations.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
All archive output is written in correctly-sized blocks, even
|
|
Packit Service |
1d0348 |
if the output is being compressed.
|
|
Packit Service |
1d0348 |
Whether or not the last output block is padded to a full
|
|
Packit Service |
1d0348 |
block size varies depending on the format and the
|
|
Packit Service |
1d0348 |
output device.
|
|
Packit Service |
1d0348 |
For tar and cpio formats, the last block of output is padded
|
|
Packit Service |
1d0348 |
to a full block size if the output is being
|
|
Packit Service |
1d0348 |
written to standard output or to a character or block device such as
|
|
Packit Service |
1d0348 |
a tape drive.
|
|
Packit Service |
1d0348 |
If the output is being written to a regular file, the last block
|
|
Packit Service |
1d0348 |
will not be padded.
|
|
Packit Service |
1d0348 |
Many compressors, including
|
|
Packit Service |
1d0348 |
[[gzip(1)|http://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1]]
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
[[bzip2(1)|http://www.freebsd.org/cgi/man.cgi?query=bzip2&sektion=1]],
|
|
Packit Service |
1d0348 |
complain about the null padding when decompressing an archive created by
|
|
Packit Service |
1d0348 |
'''tar''',
|
|
Packit Service |
1d0348 |
although they still extract it correctly.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The compression and decompression is implemented internally, so
|
|
Packit Service |
1d0348 |
there may be insignificant differences between the compressed output
|
|
Packit Service |
1d0348 |
generated by
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -czf - file
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
and that generated by
|
|
Packit Service |
1d0348 |
```text
|
|
Packit Service |
1d0348 |
tar -cf - file | gzip
|
|
Packit Service |
1d0348 |
```
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The default should be to read and write archives to the standard I/O paths,
|
|
Packit Service |
1d0348 |
but tradition (and POSIX) dictates otherwise.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
The
|
|
Packit Service |
1d0348 |
'''r'''
|
|
Packit Service |
1d0348 |
and
|
|
Packit Service |
1d0348 |
'''u'''
|
|
Packit Service |
1d0348 |
modes require that the archive be uncompressed
|
|
Packit Service |
1d0348 |
and located in a regular file on disk.
|
|
Packit Service |
1d0348 |
Other archives can be modified using
|
|
Packit Service |
1d0348 |
'''c'''
|
|
Packit Service |
1d0348 |
mode with the
|
|
Packit Service |
1d0348 |
''@archive-file''
|
|
Packit Service |
1d0348 |
extension.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
To archive a file called
|
|
Packit Service |
1d0348 |
''@foo''
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
''-foo''
|
|
Packit Service |
1d0348 |
you must specify it as
|
|
Packit Service |
1d0348 |
''./@foo''
|
|
Packit Service |
1d0348 |
or
|
|
Packit Service |
1d0348 |
''./-foo'',
|
|
Packit Service |
1d0348 |
respectively.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
In create mode, a leading
|
|
Packit Service |
1d0348 |
''./''
|
|
Packit Service |
1d0348 |
is always removed.
|
|
Packit Service |
1d0348 |
A leading
|
|
Packit Service |
1d0348 |
''/''
|
|
Packit Service |
1d0348 |
is stripped unless the
|
|
Packit Service |
1d0348 |
-P
|
|
Packit Service |
1d0348 |
option is specified.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
There needs to be better support for file selection on both create
|
|
Packit Service |
1d0348 |
and extract.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
There is not yet any support for multi-volume archives.
|
|
Packit Service |
1d0348 |
|
|
Packit Service |
1d0348 |
Converting between dissimilar archive formats (such as tar and cpio) using the
|
|
Packit Service |
1d0348 |
'''@'''''-''
|
|
Packit Service |
1d0348 |
convention can cause hard link information to be lost.
|
|
Packit Service |
1d0348 |
(This is a consequence of the incompatible ways that different archive
|
|
Packit Service |
1d0348 |
formats store hardlink information.)
|