Blame doc/html/bsdtar.1.html

Packit 08bd4c
Packit 08bd4c
Packit 08bd4c
Packit 08bd4c
"http://www.w3.org/TR/html4/loose.dtd">
Packit 08bd4c
<html>
Packit 08bd4c
<head>
Packit 08bd4c
<meta name="generator" content="groff -Thtml, see www.gnu.org">
Packit 08bd4c
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
Packit 08bd4c
<meta name="Content-Style" content="text/css">
Packit 08bd4c
<style type="text/css">
Packit 08bd4c
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
Packit 08bd4c
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
Packit 08bd4c
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
Packit 08bd4c
       h1      { text-align: center }
Packit 08bd4c
</style>
Packit 08bd4c
<title></title>
Packit 08bd4c
</head>
Packit 08bd4c
<body>
Packit 08bd4c
Packit 08bd4c

Packit 08bd4c
Packit 08bd4c
Packit 08bd4c

TAR(1) BSD General Commands Manual TAR(1)

Packit 08bd4c
Packit 08bd4c

NAME

Packit 08bd4c
Packit 08bd4c

tar — manipulate

Packit 08bd4c
tape archives

Packit 08bd4c
Packit 08bd4c

SYNOPSIS

Packit 08bd4c
Packit 08bd4c

tar

Packit 08bd4c
[bundled-flags 

Packit 08bd4c
Packit 08bd4c

args ⟩ ] [⟨

Packit 08bd4c
file ⟩  | ⟨ 
Packit 08bd4c
pattern ⟩  ...]

Packit 08bd4c
Packit 08bd4c

tar {-c}

Packit 08bd4c
[options]
Packit 08bd4c
[files directories] 
Packit 08bd4c
tar {-r -u} -f
Packit 08bd4c
archive-file [options]
Packit 08bd4c
[files directories] 
Packit 08bd4c
tar {-t -x} [options]
Packit 08bd4c
[patterns]

Packit 08bd4c
Packit 08bd4c

DESCRIPTION

Packit 08bd4c
Packit 08bd4c

tar creates and

Packit 08bd4c
manipulates streaming archive files. This implementation can
Packit 08bd4c
extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip,
Packit 08bd4c
and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
Packit 08bd4c
zip, 7-zip, and shar archives.

Packit 08bd4c
Packit 08bd4c

The first

Packit 08bd4c
synopsis form shows a ’’bundled’’
Packit 08bd4c
option word. This usage is provided for compatibility with
Packit 08bd4c
historical implementations. See COMPATIBILITY below for
Packit 08bd4c
details.

Packit 08bd4c
Packit 08bd4c

The other

Packit 08bd4c
synopsis forms show the preferred usage. The first option to
Packit 08bd4c
tar is a mode indicator from the following list:

Packit 08bd4c
Packit 08bd4c

-c

Packit 08bd4c
Packit 08bd4c

Create a new

Packit 08bd4c
archive containing the specified items. The long option form
Packit 08bd4c
is --create.

Packit 08bd4c
Packit 08bd4c

-r

Packit 08bd4c
Packit 08bd4c

Like -c,

Packit 08bd4c
but new entries are appended to the archive. Note that this
Packit 08bd4c
only works on uncompressed archives stored in regular files.
Packit 08bd4c
The -f option is required. The long option form is
Packit 08bd4c
--append.

Packit 08bd4c
Packit 08bd4c

-t

Packit 08bd4c
Packit 08bd4c

List archive

Packit 08bd4c
contents to stdout. The long option form is
Packit 08bd4c
--list.

Packit 08bd4c
Packit 08bd4c

-u

Packit 08bd4c
Packit 08bd4c

Like -r,

Packit 08bd4c
but new entries are added only if they have a modification
Packit 08bd4c
date newer than the corresponding entry in the archive. Note
Packit 08bd4c
that this only works on uncompressed archives stored in
Packit 08bd4c
regular files. The -f option is required. The long
Packit 08bd4c
form is --update.

Packit 08bd4c
Packit 08bd4c

-x

Packit 08bd4c
Packit 08bd4c

Extract to disk

Packit 08bd4c
from the archive. If a file with the same name appears more
Packit 08bd4c
than once in the archive, each copy will be extracted, with
Packit 08bd4c
later copies overwriting (replacing) earlier copies. The
Packit 08bd4c
long option form is --extract.

Packit 08bd4c
Packit 08bd4c

In -c,

Packit 08bd4c
-r, or -u mode, each specified file or
Packit 08bd4c
directory is added to the archive in the order specified on
Packit 08bd4c
the command line. By default, the contents of each directory
Packit 08bd4c
are also archived.

Packit 08bd4c
Packit 08bd4c

In extract or

Packit 08bd4c
list mode, the entire command line is read and parsed before
Packit 08bd4c
the archive is opened. The pathnames or patterns on the
Packit 08bd4c
command line indicate which items in the archive should be
Packit 08bd4c
processed. Patterns are shell-style globbing patterns as
Packit 08bd4c
documented in tcsh(1).

Packit 08bd4c
Packit 08bd4c

OPTIONS

Packit 08bd4c
Packit 08bd4c

Unless specifically stated

Packit 08bd4c
otherwise, options are applicable in all operating
Packit 08bd4c
modes.

Packit 08bd4c
Packit 08bd4c

@archive

Packit 08bd4c
Packit 08bd4c

(c and r modes only) The

Packit 08bd4c
specified archive is opened and the entries in it will be
Packit 08bd4c
appended to the current archive. As a simple example,

Packit 08bd4c
Packit 08bd4c

tar -c -f -

Packit 08bd4c
newfile @original.tar

Packit 08bd4c
Packit 08bd4c

writes a new archive to

Packit 08bd4c
standard output containing a file newfile and all of
Packit 08bd4c
the entries from original.tar. In contrast,

Packit 08bd4c
Packit 08bd4c

tar -c -f - newfile

Packit 08bd4c
original.tar

Packit 08bd4c
Packit 08bd4c

creates a new archive with only

Packit 08bd4c
two entries. Similarly,

Packit 08bd4c
Packit 08bd4c

tar -czf -

Packit 08bd4c
--format pax @-

Packit 08bd4c
Packit 08bd4c

reads an archive from standard

Packit 08bd4c
input (whose format will be determined automatically) and
Packit 08bd4c
converts it into a gzip-compressed pax-format archive on
Packit 08bd4c
stdout. In this way, tar can be used to convert
Packit 08bd4c
archives from one format to another.

Packit 08bd4c
Packit 08bd4c

-a,

Packit 08bd4c
--auto-compress

Packit 08bd4c
Packit 08bd4c

(c mode only) Use the archive

Packit 08bd4c
suffix to decide a set of the format and the compressions.
Packit 08bd4c
As a simple example,

Packit 08bd4c
Packit 08bd4c

tar -a -cf

Packit 08bd4c
archive.tgz source.c source.h

Packit 08bd4c
Packit 08bd4c

creates a new archive with

Packit 08bd4c
restricted pax format and gzip compression,

Packit 08bd4c
Packit 08bd4c

tar -a -cf

Packit 08bd4c
archive.tar.bz2.uu source.c source.h

Packit 08bd4c
Packit 08bd4c

creates a new archive with

Packit 08bd4c
restricted pax format and bzip2 compression and uuencode
Packit 08bd4c
compression,

Packit 08bd4c
Packit 08bd4c

tar -a -cf

Packit 08bd4c
archive.zip source.c source.h

Packit 08bd4c
Packit 08bd4c

creates a new archive with zip

Packit 08bd4c
format,

Packit 08bd4c
Packit 08bd4c

tar -a -jcf

Packit 08bd4c
archive.tgz source.c source.h

Packit 08bd4c
Packit 08bd4c

ignores the

Packit 08bd4c
’’-j’’ option, and creates a new
Packit 08bd4c
archive with restricted pax format and gzip compression,

Packit 08bd4c
Packit 08bd4c

tar -a -jcf

Packit 08bd4c
archive.xxx source.c source.h

Packit 08bd4c
Packit 08bd4c

if it is unknown suffix or no

Packit 08bd4c
suffix, creates a new archive with restricted pax format and
Packit 08bd4c
bzip2 compression.

Packit 08bd4c
Packit 08bd4c

--acls

Packit 08bd4c
Packit 08bd4c

(c, r, u, x

Packit 08bd4c
modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This
Packit 08bd4c
is the reverse of --no-acls and the default behavior
Packit 08bd4c
in c, r, and u modes (except on Mac OS X) or if tar
Packit 08bd4c
is run in x mode as root. On Mac OS X this option translates
Packit 08bd4c
extended ACLs to NFSv4 ACLs. To store extended ACLs the
Packit 08bd4c
--mac-metadata option is preferred.

Packit 08bd4c
Packit 08bd4c

-B,

Packit 08bd4c
--read-full-blocks

Packit 08bd4c
Packit 08bd4c

Ignored for compatibility with

Packit 08bd4c
other tar(1) implementations.

Packit 08bd4c
Packit 08bd4c

-b blocksize,

Packit 08bd4c
--block-size blocksize

Packit 08bd4c
Packit 08bd4c

Specify the block size, in

Packit 08bd4c
512-byte records, for tape drive I/O. As a rule, this
Packit 08bd4c
argument is only needed when reading from or writing to tape
Packit 08bd4c
drives, and usually not even then as the default block size
Packit 08bd4c
of 20 records (10240 bytes) is very common.

Packit 08bd4c
Packit 08bd4c

-C directory,

Packit 08bd4c
--cd directory, --directory
Packit 08bd4c
directory

Packit 08bd4c
Packit 08bd4c

In c and r mode, this changes

Packit 08bd4c
the directory before adding the following files. In x mode,
Packit 08bd4c
change directories after opening the archive but before
Packit 08bd4c
extracting entries from the archive.

Packit 08bd4c
Packit 08bd4c

--chroot

Packit 08bd4c
Packit 08bd4c

(x mode only) chroot()

Packit 08bd4c
to the current directory after processing any -C
Packit 08bd4c
options and before extracting any files.

Packit 08bd4c
Packit 08bd4c
Packit 08bd4c

--clear-nochange-fflags

Packit 08bd4c
Packit 08bd4c

(x mode only) Before removing

Packit 08bd4c
file system objects to replace them, clear platform-specific
Packit 08bd4c
file flags that might prevent removal.

Packit 08bd4c
Packit 08bd4c

--exclude

Packit 08bd4c
pattern

Packit 08bd4c
Packit 08bd4c

Do not process files or

Packit 08bd4c
directories that match the specified pattern. Note that
Packit 08bd4c
exclusions take precedence over patterns or filenames
Packit 08bd4c
specified on the command line.

Packit 08bd4c
Packit 08bd4c

--fflags

Packit 08bd4c
Packit 08bd4c

(c, r, u, x modes only) Archive

Packit 08bd4c
or extract file flags. This is the reverse of
Packit 08bd4c
--no-fflags and the default behavior in c, r, and u
Packit 08bd4c
modes or if tar is run in x mode as root.

Packit 08bd4c
Packit 08bd4c

--format

Packit 08bd4c
format

Packit 08bd4c
Packit 08bd4c

(c, r, u mode only) Use the

Packit 08bd4c
specified format for the created archive. Supported formats
Packit 08bd4c
include ’’cpio’’,
Packit 08bd4c
’’pax’’,
Packit 08bd4c
’’shar’’, and
Packit 08bd4c
’’ustar’’. Other formats may also be
Packit 08bd4c
supported; see libarchive-formats(5) for more information
Packit 08bd4c
about currently-supported formats. In r and u modes, when
Packit 08bd4c
extending an existing archive, the format specified here
Packit 08bd4c
must be compatible with the format of the existing archive
Packit 08bd4c
on disk.

Packit 08bd4c
Packit 08bd4c

-f file,

Packit 08bd4c
--file file

Packit 08bd4c
Packit 08bd4c

Read the archive from or write

Packit 08bd4c
the archive to the specified file. The filename can be
Packit 08bd4c
- for standard input or standard output. The default
Packit 08bd4c
varies by system; on FreeBSD, the default is
Packit 08bd4c
/dev/sa0; on Linux, the default is
Packit 08bd4c
/dev/st0.

Packit 08bd4c
Packit 08bd4c

--gid id

Packit 08bd4c
Packit 08bd4c

Use the provided group id

Packit 08bd4c
number. On extract, this overrides the group id in the
Packit 08bd4c
archive; the group name in the archive will be ignored. On
Packit 08bd4c
create, this overrides the group id read from disk; if
Packit 08bd4c
--gname is not also specified, the group name will be
Packit 08bd4c
set to match the group id.

Packit 08bd4c
Packit 08bd4c

--gname name

Packit 08bd4c
Packit 08bd4c

Use the provided group name. On

Packit 08bd4c
extract, this overrides the group name in the archive; if
Packit 08bd4c
the provided group name does not exist on the system, the
Packit 08bd4c
group id (from the archive or from the --gid option)
Packit 08bd4c
will be used instead. On create, this sets the group name
Packit 08bd4c
that will be stored in the archive; the name will not be
Packit 08bd4c
verified against the system group database.

Packit 08bd4c
Packit 08bd4c

-H

Packit 08bd4c
Packit 08bd4c

(c and r modes

Packit 08bd4c
only) Symbolic links named on the command line will be
Packit 08bd4c
followed; the target of the link will be archived, not the
Packit 08bd4c
link itself.

Packit 08bd4c
Packit 08bd4c

-h

Packit 08bd4c
Packit 08bd4c

(c and r modes

Packit 08bd4c
only) Synonym for -L.

Packit 08bd4c
Packit 08bd4c

-I

Packit 08bd4c
Packit 08bd4c

Synonym for

Packit 08bd4c
-T.

Packit 08bd4c
Packit 08bd4c

--help

Packit 08bd4c
Packit 08bd4c

Show usage.

Packit 08bd4c
Packit 08bd4c

--hfsCompression

Packit 08bd4c
Packit 08bd4c

(x mode only) Mac OS X specific

Packit 08bd4c
(v10.6 or later). Compress extracted regular files with HFS+
Packit 08bd4c
compression.

Packit 08bd4c
Packit 08bd4c

--ignore-zeros

Packit 08bd4c
Packit 08bd4c

An alias of --options

Packit 08bd4c
read_concatenated_archives for compatibility with GNU
Packit 08bd4c
tar.

Packit 08bd4c
Packit 08bd4c

--include

Packit 08bd4c
pattern

Packit 08bd4c
Packit 08bd4c

Process only files or

Packit 08bd4c
directories that match the specified pattern. Note that
Packit 08bd4c
exclusions specified with --exclude take precedence
Packit 08bd4c
over inclusions. If no inclusions are explicitly specified,
Packit 08bd4c
all entries are processed by default. The --include
Packit 08bd4c
option is especially useful when filtering archives. For
Packit 08bd4c
example, the command

Packit 08bd4c
Packit 08bd4c

tar -c -f new.tar

Packit 08bd4c
--include=’*foo*’ @old.tgz

Packit 08bd4c
Packit 08bd4c

creates a new archive

Packit 08bd4c
new.tar containing only the entries from
Packit 08bd4c
old.tgz containing the string ’foo’.

Packit 08bd4c
Packit 08bd4c

-J, --xz

Packit 08bd4c
Packit 08bd4c

(c mode only) Compress the

Packit 08bd4c
resulting archive with xz(1). In extract or list modes, this
Packit 08bd4c
option is ignored. Note that, unlike other tar
Packit 08bd4c
implementations, this implementation recognizes XZ
Packit 08bd4c
compression automatically when reading archives.

Packit 08bd4c
Packit 08bd4c

-j, --bzip,

Packit 08bd4c
--bzip2, --bunzip2

Packit 08bd4c
Packit 08bd4c

(c mode only) Compress the

Packit 08bd4c
resulting archive with bzip2(1). In extract or list modes,
Packit 08bd4c
this option is ignored. Note that, unlike other tar
Packit 08bd4c
implementations, this implementation recognizes bzip2
Packit 08bd4c
compression automatically when reading archives.

Packit 08bd4c
Packit 08bd4c

-k,

Packit 08bd4c
--keep-old-files

Packit 08bd4c
Packit 08bd4c

(x mode only) Do not overwrite

Packit 08bd4c
existing files. In particular, if a file appears more than
Packit 08bd4c
once in an archive, later copies will not overwrite earlier
Packit 08bd4c
copies.

Packit 08bd4c
Packit 08bd4c

--keep-newer-files

Packit 08bd4c
Packit 08bd4c

(x mode only) Do not overwrite

Packit 08bd4c
existing files that are newer than the versions appearing in
Packit 08bd4c
the archive being extracted.

Packit 08bd4c
Packit 08bd4c

-L,

Packit 08bd4c
--dereference

Packit 08bd4c
Packit 08bd4c

(c and r modes only) All

Packit 08bd4c
symbolic links will be followed. Normally, symbolic links
Packit 08bd4c
are archived as such. With this option, the target of the
Packit 08bd4c
link will be archived instead.

Packit 08bd4c
Packit 08bd4c

-l,

Packit 08bd4c
--check-links

Packit 08bd4c
Packit 08bd4c

(c and r modes only) Issue a

Packit 08bd4c
warning message unless all links to each file are
Packit 08bd4c
archived.

Packit 08bd4c
Packit 08bd4c

--lrzip

Packit 08bd4c
Packit 08bd4c

(c mode only) Compress the

Packit 08bd4c
resulting archive with lrzip(1). In extract or list modes,
Packit 08bd4c
this option is ignored.

Packit 08bd4c
Packit 08bd4c

--lz4

Packit 08bd4c
Packit 08bd4c

(c mode only)

Packit 08bd4c
Compress the archive with lz4-compatible compression before
Packit 08bd4c
writing it. In input mode, this option is ignored; lz4
Packit 08bd4c
compression is recognized automatically on input.

Packit 08bd4c
Packit 08bd4c

--lzma

Packit 08bd4c
Packit 08bd4c

(c mode only)

Packit 08bd4c
Compress the resulting archive with the original LZMA
Packit 08bd4c
algorithm. Use of this option is discouraged and new
Packit 08bd4c
archives should be created with --xz instead. Note
Packit 08bd4c
that, unlike other tar implementations, this
Packit 08bd4c
implementation recognizes LZMA compression automatically
Packit 08bd4c
when reading archives.

Packit 08bd4c
Packit 08bd4c

--lzop

Packit 08bd4c
Packit 08bd4c

(c mode only)

Packit 08bd4c
Compress the resulting archive with lzop(1). In extract or
Packit 08bd4c
list modes, this option is ignored.

Packit 08bd4c
Packit 08bd4c

-m,

Packit 08bd4c
--modification-time

Packit 08bd4c
Packit 08bd4c

(x mode only) Do not extract

Packit 08bd4c
modification time. By default, the modification time is set
Packit 08bd4c
to the time stored in the archive.

Packit 08bd4c
Packit 08bd4c

--mac-metadata

Packit 08bd4c
Packit 08bd4c

(c, r, u and x mode only) Mac

Packit 08bd4c
OS X specific. Archive or extract extended ACLs and extended
Packit 08bd4c
attributes using copyfile(3) in AppleDouble format. This is
Packit 08bd4c
the reverse of --no-mac-metadata. and the default
Packit 08bd4c
behavior in c, r, and u modes or if tar is run in x
Packit 08bd4c
mode as root.

Packit 08bd4c
Packit 08bd4c

-n, --norecurse,

Packit 08bd4c
--no-recursion

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Do not

Packit 08bd4c
recursively archive the contents of directories.

Packit 08bd4c
Packit 08bd4c

--newer date

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Only

Packit 08bd4c
include files and directories newer than the specified date.
Packit 08bd4c
This compares ctime entries.

Packit 08bd4c
Packit 08bd4c

--newer-mtime

Packit 08bd4c
date

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Like

Packit 08bd4c
--newer, except it compares mtime entries instead of
Packit 08bd4c
ctime entries.

Packit 08bd4c
Packit 08bd4c

--newer-than

Packit 08bd4c
file

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Only

Packit 08bd4c
include files and directories newer than the specified file.
Packit 08bd4c
This compares ctime entries.

Packit 08bd4c
Packit 08bd4c

--newer-mtime-than

Packit 08bd4c
file

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Like

Packit 08bd4c
--newer-than, except it compares mtime entries
Packit 08bd4c
instead of ctime entries.

Packit 08bd4c
Packit 08bd4c

--nodump

Packit 08bd4c
Packit 08bd4c

(c and r modes only) Honor the

Packit 08bd4c
nodump file flag by skipping this file.

Packit 08bd4c
Packit 08bd4c
Packit 08bd4c

--nopreserveHFSCompression

Packit 08bd4c
Packit 08bd4c

(x mode only) Mac OS X specific

Packit 08bd4c
(v10.6 or later). Do not compress extracted regular files
Packit 08bd4c
which were compressed with HFS+ compression before archived.
Packit 08bd4c
By default, compress the regular files again with HFS+
Packit 08bd4c
compression.

Packit 08bd4c
Packit 08bd4c

--null

Packit 08bd4c
Packit 08bd4c

(use with

Packit 08bd4c
-I or -T) Filenames or patterns are separated
Packit 08bd4c
by null characters, not by newlines. This is often used to
Packit 08bd4c
read filenames output by the -print0 option to
Packit 08bd4c
find(1).

Packit 08bd4c
Packit 08bd4c

--no-acls

Packit 08bd4c
Packit 08bd4c

(c, r, u, x modes only) Do not

Packit 08bd4c
archive or extract POSIX.1e or NFSv4 ACLs. This is the
Packit 08bd4c
reverse of --acls and the default behavior if
Packit 08bd4c
tar is run as non-root in x mode (on Mac OS X as any
Packit 08bd4c
user in c, r, u and x modes).

Packit 08bd4c
Packit 08bd4c

--no-fflags

Packit 08bd4c
Packit 08bd4c

(c, r, u, x modes only) Do not

Packit 08bd4c
archive or extract file flags. This is the reverse of
Packit 08bd4c
--fflags and the default behavior if tar is
Packit 08bd4c
run as non-root in x mode.

Packit 08bd4c
Packit 08bd4c

--no-mac-metadata

Packit 08bd4c
Packit 08bd4c

(x mode only) Mac OS X

Packit 08bd4c
specific. Do not archive or extract ACLs and extended
Packit 08bd4c
attributes using copyfile(3) in AppleDouble format. This is
Packit 08bd4c
the reverse of --mac-metadata. and the default
Packit 08bd4c
behavior if tar is run as non-root in x mode.

Packit 08bd4c
Packit 08bd4c

-n, --norecurse,

Packit 08bd4c
--no-recursion

Packit 08bd4c
Packit 08bd4c

--no-same-owner

Packit 08bd4c
Packit 08bd4c

(x mode only) Do not extract

Packit 08bd4c
owner and group IDs. This is the reverse of
Packit 08bd4c
--same-owner and the default behavior if tar
Packit 08bd4c
is run as non-root.

Packit 08bd4c
Packit 08bd4c
Packit 08bd4c

--no-same-permissions

Packit 08bd4c
Packit 08bd4c

(x mode only) Do not extract

Packit 08bd4c
full permissions (SGID, SUID, sticky bit, ACLs, extended
Packit 08bd4c
attributes or extended file flags). This is the reverse of
Packit 08bd4c
-p and the default behavior if tar is run as
Packit 08bd4c
non-root.

Packit 08bd4c
Packit 08bd4c

--no-xattrs

Packit 08bd4c
Packit 08bd4c

(c, r, u, x modes only) Do not

Packit 08bd4c
archive or extract extended attributes. This is the reverse
Packit 08bd4c
of --xattrs and the default behavior if tar is
Packit 08bd4c
run as non-root in x mode.

Packit 08bd4c
Packit 08bd4c

--numeric-owner

Packit 08bd4c
Packit 08bd4c

This is equivalent to

Packit 08bd4c
--uname "" --gname "". On
Packit 08bd4c
extract, it causes user and group names in the archive to be
Packit 08bd4c
ignored in favor of the numeric user and group ids. On
Packit 08bd4c
create, it causes user and group names to not be stored in
Packit 08bd4c
the archive.

Packit 08bd4c
Packit 08bd4c

-O,

Packit 08bd4c
--to-stdout

Packit 08bd4c
Packit 08bd4c

(x, t modes only) In extract

Packit 08bd4c
(-x) mode, files will be written to standard out rather than
Packit 08bd4c
being extracted to disk. In list (-t) mode, the file listing
Packit 08bd4c
will be written to stderr rather than the usual stdout.

Packit 08bd4c
Packit 08bd4c

-o

Packit 08bd4c
Packit 08bd4c

(x mode) Use

Packit 08bd4c
the user and group of the user running the program rather
Packit 08bd4c
than those specified in the archive. Note that this has no
Packit 08bd4c
significance unless -p is specified, and the program
Packit 08bd4c
is being run by the root user. In this case, the file modes
Packit 08bd4c
and flags from the archive will be restored, but ACLs or
Packit 08bd4c
owner information in the archive will be discarded.

Packit 08bd4c
Packit 08bd4c

-o

Packit 08bd4c
Packit 08bd4c

(c, r, u mode)

Packit 08bd4c
A synonym for --format ustar

Packit 08bd4c
Packit 08bd4c

--older date

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Only

Packit 08bd4c
include files and directories older than the specified date.
Packit 08bd4c
This compares ctime entries.

Packit 08bd4c
Packit 08bd4c

--older-mtime

Packit 08bd4c
date

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Like

Packit 08bd4c
--older, except it compares mtime entries instead of
Packit 08bd4c
ctime entries.

Packit 08bd4c
Packit 08bd4c

--older-than

Packit 08bd4c
file

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Only

Packit 08bd4c
include files and directories older than the specified file.
Packit 08bd4c
This compares ctime entries.

Packit 08bd4c
Packit 08bd4c

--older-mtime-than

Packit 08bd4c
file

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) Like

Packit 08bd4c
--older-than, except it compares mtime entries
Packit 08bd4c
instead of ctime entries.

Packit 08bd4c
Packit 08bd4c

--one-file-system

Packit 08bd4c
Packit 08bd4c

(c, r, and u modes) Do not

Packit 08bd4c
cross mount points.

Packit 08bd4c
Packit 08bd4c

--options

Packit 08bd4c
options

Packit 08bd4c
Packit 08bd4c

Select optional behaviors for

Packit 08bd4c
particular modules. The argument is a text string containing
Packit 08bd4c
comma-separated keywords and values. These are passed to the
Packit 08bd4c
modules that handle particular formats to control how those
Packit 08bd4c
formats will behave. Each option has one of the following
Packit 08bd4c
forms:

Packit 08bd4c
Packit 08bd4c

key=value

Packit 08bd4c
Packit 08bd4c

The key will be set to the

Packit 08bd4c
specified value in every module that supports it. Modules
Packit 08bd4c
that do not support this key will ignore it.

Packit 08bd4c
Packit 08bd4c

key

Packit 08bd4c
Packit 08bd4c

The key will be

Packit 08bd4c
enabled in every module that supports it. This is equivalent
Packit 08bd4c
to key=1.

Packit 08bd4c
Packit 08bd4c

!key

Packit 08bd4c
Packit 08bd4c

The key will be

Packit 08bd4c
disabled in every module that supports it.

Packit 08bd4c
Packit 08bd4c

module:key=value, module:key,

Packit 08bd4c
module:!key

Packit 08bd4c
Packit 08bd4c

As above, but the corresponding

Packit 08bd4c
key and value will be provided only to modules whose name
Packit 08bd4c
matches module.

Packit 08bd4c
Packit 08bd4c

The currently supported modules

Packit 08bd4c
and keys are:

Packit 08bd4c
Packit 08bd4c

iso9660:joliet

Packit 08bd4c
Packit 08bd4c

Support Joliet extensions. This

Packit 08bd4c
is enabled by default, use !joliet or
Packit 08bd4c
iso9660:!joliet to disable.

Packit 08bd4c
Packit 08bd4c

iso9660:rockridge

Packit 08bd4c
Packit 08bd4c

Support Rock Ridge extensions.

Packit 08bd4c
This is enabled by default, use !rockridge or
Packit 08bd4c
iso9660:!rockridge to disable.

Packit 08bd4c
Packit 08bd4c

gzip:compression-level

Packit 08bd4c
Packit 08bd4c

A decimal integer from 1 to 9

Packit 08bd4c
specifying the gzip compression level.

Packit 08bd4c
Packit 08bd4c

gzip:timestamp

Packit 08bd4c
Packit 08bd4c

Store timestamp. This is

Packit 08bd4c
enabled by default, use !timestamp or
Packit 08bd4c
gzip:!timestamp to disable.

Packit 08bd4c
Packit 08bd4c

lrzip:compression=type

Packit 08bd4c
Packit 08bd4c

Use type as compression

Packit 08bd4c
method. Supported values are bzip2, gzip, lzo (ultra fast),
Packit 08bd4c
and zpaq (best, extremely slow).

Packit 08bd4c
Packit 08bd4c

lrzip:compression-level

Packit 08bd4c
Packit 08bd4c

A decimal integer from 1 to 9

Packit 08bd4c
specifying the lrzip compression level.

Packit 08bd4c
Packit 08bd4c

lz4:compression-level

Packit 08bd4c
Packit 08bd4c

A decimal integer from 1 to 9

Packit 08bd4c
specifying the lzop compression level.

Packit 08bd4c
Packit 08bd4c

lz4:stream-checksum

Packit 08bd4c
Packit 08bd4c

Enable stream checksum. This is

Packit 08bd4c
by default, use lz4:!stream-checksum to disable.

Packit 08bd4c
Packit 08bd4c

lz4:block-checksum

Packit 08bd4c
Packit 08bd4c

Enable block checksum (Disabled

Packit 08bd4c
by default).

Packit 08bd4c
Packit 08bd4c

lz4:block-size

Packit 08bd4c
Packit 08bd4c

A decimal integer from 4 to 7

Packit 08bd4c
specifying the lz4 compression block size (7 is set by
Packit 08bd4c
default).

Packit 08bd4c
Packit 08bd4c

lz4:block-dependence

Packit 08bd4c
Packit 08bd4c

Use the previous block of the

Packit 08bd4c
block being compressed for a compression dictionary to
Packit 08bd4c
improve compression ratio.

Packit 08bd4c
Packit 08bd4c

lzop:compression-level

Packit 08bd4c
Packit 08bd4c

A decimal integer from 1 to 9

Packit 08bd4c
specifying the lzop compression level.

Packit 08bd4c
Packit 08bd4c

xz:compression-level

Packit 08bd4c
Packit 08bd4c

A decimal integer from 0 to 9

Packit 08bd4c
specifying the xz compression level.

Packit 08bd4c
Packit 08bd4c

mtree:keyword

Packit 08bd4c
Packit 08bd4c

The mtree writer module allows

Packit 08bd4c
you to specify which mtree keywords will be included in the
Packit 08bd4c
output. Supported keywords include: cksum,
Packit 08bd4c
device, flags, gid, gname,
Packit 08bd4c
indent, link, md5, mode,
Packit 08bd4c
nlink, rmd160, sha1, sha256,
Packit 08bd4c
sha384, sha512, size, time,
Packit 08bd4c
uid, uname. The default is equivalent to:
Packit 08bd4c
’’device, flags, gid, gname, link, mode, nlink,
Packit 08bd4c
size, time, type, uid, uname’’.

Packit 08bd4c
Packit 08bd4c

mtree:all

Packit 08bd4c
Packit 08bd4c

Enables all of the above

Packit 08bd4c
keywords. You can also use mtree:!all to disable all
Packit 08bd4c
keywords.

Packit 08bd4c
Packit 08bd4c

mtree:use-set

Packit 08bd4c
Packit 08bd4c

Enable generation of

Packit 08bd4c
/set lines in the output.

Packit 08bd4c
Packit 08bd4c

mtree:indent

Packit 08bd4c
Packit 08bd4c

Produce human-readable output

Packit 08bd4c
by indenting options and splitting lines to fit into 80
Packit 08bd4c
columns.

Packit 08bd4c
Packit 08bd4c

zip:compression=type

Packit 08bd4c
Packit 08bd4c

Use type as compression

Packit 08bd4c
method. Supported values are store (uncompressed) and
Packit 08bd4c
deflate (gzip algorithm).

Packit 08bd4c
Packit 08bd4c

zip:encryption

Packit 08bd4c
Packit 08bd4c

Enable encryption using

Packit 08bd4c
traditional zip encryption.

Packit 08bd4c
Packit 08bd4c

zip:encryption=type

Packit 08bd4c
Packit 08bd4c

Use type as encryption

Packit 08bd4c
type. Supported values are zipcrypt (traditional zip
Packit 08bd4c
encryption), aes128 (WinZip AES-128 encryption) and aes256
Packit 08bd4c
(WinZip AES-256 encryption).

Packit 08bd4c
Packit 08bd4c

read_concatenated_archives

Packit 08bd4c
Packit 08bd4c

Ignore zeroed blocks in the

Packit 08bd4c
archive, which occurs when multiple tar archives have been
Packit 08bd4c
concatenated together. Without this option, only the
Packit 08bd4c
contents of the first concatenated archive would be read.
Packit 08bd4c
This option is comparable to the -i,
Packit 08bd4c
--ignore-zeros option of GNU tar.

Packit 08bd4c
Packit 08bd4c

If a provided option is not

Packit 08bd4c
supported by any module, that is a fatal error.

Packit 08bd4c
Packit 08bd4c

-P,

Packit 08bd4c
--absolute-paths

Packit 08bd4c
Packit 08bd4c

Preserve pathnames. By default,

Packit 08bd4c
absolute pathnames (those that begin with a / character)
Packit 08bd4c
have the leading slash removed both when creating archives
Packit 08bd4c
and extracting from them. Also, tar will refuse to
Packit 08bd4c
extract archive entries whose pathnames contain .. or
Packit 08bd4c
whose target directory would be altered by a symlink. This
Packit 08bd4c
option suppresses these behaviors.

Packit 08bd4c
Packit 08bd4c

-p, --insecure,

Packit 08bd4c
--preserve-permissions

Packit 08bd4c
Packit 08bd4c

(x mode only) Preserve file

Packit 08bd4c
permissions. Attempt to restore the full permissions,
Packit 08bd4c
including owner, file modes, ACLs, extended attributes and
Packit 08bd4c
extended file flags, if available, for each item extracted
Packit 08bd4c
from the archive. This is te reverse of
Packit 08bd4c
--no-same-permissions and the default if tar
Packit 08bd4c
is being run by root and can be partially overridden by also
Packit 08bd4c
specifying --no-acls, --no-fflags,
Packit 08bd4c
--no-mac-metadata or --no-xattrs.

Packit 08bd4c
Packit 08bd4c

--passphrase

Packit 08bd4c
passphrase

Packit 08bd4c
Packit 08bd4c

The passphrase is used

Packit 08bd4c
to extract or create an encrypted archive. Currently, zip is
Packit 08bd4c
the only supported format that supports encryption. You
Packit 08bd4c
shouldn’t use this option unless you realize how
Packit 08bd4c
insecure use of this option is.

Packit 08bd4c
Packit 08bd4c

--posix

Packit 08bd4c
Packit 08bd4c

(c, r, u mode only) Synonym for

Packit 08bd4c
--format pax

Packit 08bd4c
Packit 08bd4c

-q,

Packit 08bd4c
--fast-read

Packit 08bd4c
Packit 08bd4c

(x and t mode only) Extract or

Packit 08bd4c
list only the first archive entry that matches each pattern
Packit 08bd4c
or filename operand. Exit as soon as each specified pattern
Packit 08bd4c
or filename has been matched. By default, the archive is
Packit 08bd4c
always read to the very end, since there can be multiple
Packit 08bd4c
entries with the same name and, by convention, later entries
Packit 08bd4c
overwrite earlier entries. This option is provided as a
Packit 08bd4c
performance optimization.

Packit 08bd4c
Packit 08bd4c

-S

Packit 08bd4c
Packit 08bd4c

(x mode only)

Packit 08bd4c
Extract files as sparse files. For every block on disk,
Packit 08bd4c
check first if it contains only NULL bytes and seek over it
Packit 08bd4c
otherwise. This works similar to the conv=sparse option of
Packit 08bd4c
dd.

Packit 08bd4c
Packit 08bd4c

-s pattern

Packit 08bd4c
Packit 08bd4c

Modify file or archive member

Packit 08bd4c
names according to pattern. The pattern has the
Packit 08bd4c
format /old/new/[ghHprRsS] where old is a
Packit 08bd4c
basic regular expression, new is the replacement
Packit 08bd4c
string of the matched part, and the optional trailing
Packit 08bd4c
letters modify how the replacement is handled. If old
Packit 08bd4c
is not matched, the pattern is skipped. Within new, ~
Packit 08bd4c
is substituted with the match, \1 to \9 with the content of
Packit 08bd4c
the corresponding captured group. The optional trailing g
Packit 08bd4c
specifies that matching should continue after the matched
Packit 08bd4c
part and stop on the first unmatched pattern. The optional
Packit 08bd4c
trailing s specifies that the pattern applies to the value
Packit 08bd4c
of symbolic links. The optional trailing p specifies that
Packit 08bd4c
after a successful substitution the original path name and
Packit 08bd4c
the new path name should be printed to standard error.
Packit 08bd4c
Optional trailing H, R, or S characters suppress
Packit 08bd4c
substitutions for hardlink targets, regular filenames, or
Packit 08bd4c
symlink targets, respectively. Optional trailing h, r, or s
Packit 08bd4c
characters enable substitutions for hardlink targets,
Packit 08bd4c
regular filenames, or symlink targets, respectively. The
Packit 08bd4c
default is hrs which applies substitutions to all
Packit 08bd4c
names. In particular, it is never necessary to specify h, r,
Packit 08bd4c
or s.

Packit 08bd4c
Packit 08bd4c

--same-owner

Packit 08bd4c
Packit 08bd4c

(x mode only) Extract owner and

Packit 08bd4c
group IDs. This is the reverse of --no-same-owner and
Packit 08bd4c
the default behavior if tar is run as root.

Packit 08bd4c
Packit 08bd4c

--strip-components

Packit 08bd4c
count

Packit 08bd4c
Packit 08bd4c

Remove the specified number of

Packit 08bd4c
leading path elements. Pathnames with fewer elements will be
Packit 08bd4c
silently skipped. Note that the pathname is edited after
Packit 08bd4c
checking inclusion/exclusion patterns but before security
Packit 08bd4c
checks.

Packit 08bd4c
Packit 08bd4c

-T filename,

Packit 08bd4c
--files-from filename

Packit 08bd4c
Packit 08bd4c

In x or t mode, tar will

Packit 08bd4c
read the list of names to be extracted from filename.
Packit 08bd4c
In c mode, tar will read names to be archived from
Packit 08bd4c
filename. The special name
Packit 08bd4c
’’-C’’ on a line by itself will
Packit 08bd4c
cause the current directory to be changed to the directory
Packit 08bd4c
specified on the following line. Names are terminated by
Packit 08bd4c
newlines unless --null is specified. Note that
Packit 08bd4c
--null also disables the special handling of lines
Packit 08bd4c
containing ’’-C’’. Note: If you are
Packit 08bd4c
generating lists of files using find(1), you probably want
Packit 08bd4c
to use -n as well.

Packit 08bd4c
Packit 08bd4c

--totals

Packit 08bd4c
Packit 08bd4c

(c, r, u modes only) After

Packit 08bd4c
archiving all files, print a summary to stderr.

Packit 08bd4c
Packit 08bd4c

-U, --unlink,

Packit 08bd4c
--unlink-first

Packit 08bd4c
Packit 08bd4c

(x mode only) Unlink files

Packit 08bd4c
before creating them. This can be a minor performance
Packit 08bd4c
optimization if most files already exist, but can make
Packit 08bd4c
things slower if most files do not already exist. This flag
Packit 08bd4c
also causes tar to remove intervening directory
Packit 08bd4c
symlinks instead of reporting an error. See the SECURITY
Packit 08bd4c
section below for more details.

Packit 08bd4c
Packit 08bd4c

--uid id

Packit 08bd4c
Packit 08bd4c

Use the provided user id number

Packit 08bd4c
and ignore the user name from the archive. On create, if
Packit 08bd4c
--uname is not also specified, the user name will be
Packit 08bd4c
set to match the user id.

Packit 08bd4c
Packit 08bd4c

--uname name

Packit 08bd4c
Packit 08bd4c

Use the provided user name. On

Packit 08bd4c
extract, this overrides the user name in the archive; if the
Packit 08bd4c
provided user name does not exist on the system, it will be
Packit 08bd4c
ignored and the user id (from the archive or from the
Packit 08bd4c
--uid option) will be used instead. On create, this
Packit 08bd4c
sets the user name that will be stored in the archive; the
Packit 08bd4c
name is not verified against the system user database.

Packit 08bd4c
Packit 08bd4c

--use-compress-program

Packit 08bd4c
program

Packit 08bd4c
Packit 08bd4c

Pipe the input (in x or t mode)

Packit 08bd4c
or the output (in c mode) through program instead of
Packit 08bd4c
using the builtin compression support.

Packit 08bd4c
Packit 08bd4c

-v, --verbose

Packit 08bd4c
Packit 08bd4c

Produce verbose output. In

Packit 08bd4c
create and extract modes, tar will list each file
Packit 08bd4c
name as it is read from or written to the archive. In list
Packit 08bd4c
mode, tar will produce output similar to that of
Packit 08bd4c
ls(1). An additional -v option will also provide
Packit 08bd4c
ls-like details in create and extract mode.

Packit 08bd4c
Packit 08bd4c

--version

Packit 08bd4c
Packit 08bd4c

Print version of tar and

Packit 08bd4c
libarchive, and exit.

Packit 08bd4c
Packit 08bd4c

-w,

Packit 08bd4c
--confirmation, --interactive

Packit 08bd4c
Packit 08bd4c

Ask for confirmation for every

Packit 08bd4c
action.

Packit 08bd4c
Packit 08bd4c

-X filename,

Packit 08bd4c
--exclude-from filename

Packit 08bd4c
Packit 08bd4c

Read a list of exclusion

Packit 08bd4c
patterns from the specified file. See --exclude for
Packit 08bd4c
more information about the handling of exclusions.

Packit 08bd4c
Packit 08bd4c

--xattrs

Packit 08bd4c
Packit 08bd4c

(c, r, u, x modes only) Archive

Packit 08bd4c
or extract extended attributes. This is the reverse of
Packit 08bd4c
--no-xattrs and the default behavior in c, r, and u
Packit 08bd4c
modes or if tar is run in x mode as root.

Packit 08bd4c
Packit 08bd4c

-y

Packit 08bd4c
Packit 08bd4c

(c mode only)

Packit 08bd4c
Compress the resulting archive with bzip2(1). In extract or
Packit 08bd4c
list modes, this option is ignored. Note that, unlike other
Packit 08bd4c
tar implementations, this implementation recognizes
Packit 08bd4c
bzip2 compression automatically when reading archives.

Packit 08bd4c
Packit 08bd4c

-Z, --compress,

Packit 08bd4c
--uncompress

Packit 08bd4c
Packit 08bd4c

(c mode only) Compress the

Packit 08bd4c
resulting archive with compress(1). In extract or list
Packit 08bd4c
modes, this option is ignored. Note that, unlike other
Packit 08bd4c
tar implementations, this implementation recognizes
Packit 08bd4c
compress compression automatically when reading
Packit 08bd4c
archives.

Packit 08bd4c
Packit 08bd4c

-z, --gunzip,

Packit 08bd4c
--gzip

Packit 08bd4c
Packit 08bd4c

(c mode only) Compress the

Packit 08bd4c
resulting archive with gzip(1). In extract or list modes,
Packit 08bd4c
this option is ignored. Note that, unlike other tar
Packit 08bd4c
implementations, this implementation recognizes gzip
Packit 08bd4c
compression automatically when reading archives.

Packit 08bd4c
Packit 08bd4c

ENVIRONMENT

Packit 08bd4c
Packit 08bd4c

The following environment

Packit 08bd4c
variables affect the execution of tar:

Packit 08bd4c
Packit 08bd4c

TAR_READER_OPTIONS

Packit 08bd4c
Packit 08bd4c

The default options for format

Packit 08bd4c
readers and compression readers. The --options option
Packit 08bd4c
overrides this.

Packit 08bd4c
Packit 08bd4c

TAR_WRITER_OPTIONS

Packit 08bd4c
Packit 08bd4c

The default options for format

Packit 08bd4c
writers and compression writers. The --options option
Packit 08bd4c
overrides this.

Packit 08bd4c
Packit 08bd4c

LANG

Packit 08bd4c
Packit 08bd4c

The locale to

Packit 08bd4c
use. See environ(7) for more information.

Packit 08bd4c
Packit 08bd4c

TAPE

Packit 08bd4c
Packit 08bd4c

The default

Packit 08bd4c
device. The -f option overrides this. Please see the
Packit 08bd4c
description of the -f option above for more
Packit 08bd4c
details.

Packit 08bd4c
Packit 08bd4c

TZ

Packit 08bd4c
Packit 08bd4c

The timezone to

Packit 08bd4c
use when displaying dates. See environ(7) for more
Packit 08bd4c
information.

Packit 08bd4c
Packit 08bd4c

EXIT STATUS

Packit 08bd4c
Packit 08bd4c

The tar utility

Packit 08bd4c
exits 0 on success, and >0 if an error
Packit 08bd4c
occurs.

Packit 08bd4c
Packit 08bd4c

EXAMPLES

Packit 08bd4c
Packit 08bd4c

The following creates a new

Packit 08bd4c
archive called file.tar.gz that contains two files
Packit 08bd4c
source.c and source.h:

Packit 08bd4c
Packit 08bd4c

tar -czf file.tar.gz

Packit 08bd4c
source.c source.h

Packit 08bd4c
Packit 08bd4c

To view a

Packit 08bd4c
detailed table of contents for this archive:

Packit 08bd4c
Packit 08bd4c

tar -tvf

Packit 08bd4c
file.tar.gz

Packit 08bd4c
Packit 08bd4c

To extract all

Packit 08bd4c
entries from the archive on the default tape drive:

Packit 08bd4c
Packit 08bd4c

tar -x

Packit 08bd4c
Packit 08bd4c

To examine the

Packit 08bd4c
contents of an ISO 9660 cdrom image:

Packit 08bd4c
Packit 08bd4c

tar -tf

Packit 08bd4c
image.iso

Packit 08bd4c
Packit 08bd4c

To move file

Packit 08bd4c
hierarchies, invoke tar as

Packit 08bd4c
Packit 08bd4c

tar -cf -

Packit 08bd4c
-C srcdir . | tar -xpf -
Packit 08bd4c
-C destdir

Packit 08bd4c
Packit 08bd4c

or more traditionally

Packit 08bd4c
Packit 08bd4c

cd srcdir ; tar -cf

Packit 08bd4c
- . | (cd destdir ; tar -xpf
Packit 08bd4c
-)

Packit 08bd4c
Packit 08bd4c

In create mode,

Packit 08bd4c
the list of files and directories to be archived can also
Packit 08bd4c
include directory change instructions of the form
Packit 08bd4c
-Cfoo/baz and archive inclusions of the form
Packit 08bd4c
@archive-file. For example, the command
Packit 08bd4c
line

Packit 08bd4c
Packit 08bd4c

tar -c -f new.tar

Packit 08bd4c
foo1 @old.tgz -C/tmp
Packit 08bd4c
foo2

Packit 08bd4c
Packit 08bd4c

will create a new archive

Packit 08bd4c
new.tar. tar will read the file foo1
Packit 08bd4c
from the current directory and add it to the output archive.
Packit 08bd4c
It will then read each entry from old.tgz and add
Packit 08bd4c
those entries to the output archive. Finally, it will switch
Packit 08bd4c
to the /tmp directory and add foo2 to the
Packit 08bd4c
output archive.

Packit 08bd4c
Packit 08bd4c

An input file in

Packit 08bd4c
mtree(5) format can be used to create an output archive with
Packit 08bd4c
arbitrary ownership, permissions, or names that differ from
Packit 08bd4c
existing data on disk:

Packit 08bd4c
Packit 08bd4c

$ cat

Packit 08bd4c
input.mtree 
Packit 08bd4c
#mtree 
Packit 08bd4c
usr/bin uid=0 gid=0 mode=0755 type=dir 
Packit 08bd4c
usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls 
Packit 08bd4c
$ tar -cvf output.tar @input.mtree

Packit 08bd4c
Packit 08bd4c

The

Packit 08bd4c
--newer and --newer-mtime switches accept a
Packit 08bd4c
variety of common date and time specifications, including
Packit 08bd4c
’’12 Mar 2005 7:14:29pm’’,
Packit 08bd4c
’’2005-03-12 19:14’’,
Packit 08bd4c
’’5 minutes ago’’, and
Packit 08bd4c
’’19:14 PST May 1’’.

Packit 08bd4c
Packit 08bd4c

The

Packit 08bd4c
--options argument can be used to control various
Packit 08bd4c
details of archive generation or reading. For example, you
Packit 08bd4c
can generate mtree output which only contains type,
Packit 08bd4c
time, and uid keywords:

Packit 08bd4c
Packit 08bd4c

tar -cf file.tar

Packit 08bd4c
--format=mtree
Packit 08bd4c
--options=’!all,type,time,uid’
Packit 08bd4c
dir

Packit 08bd4c
Packit 08bd4c

or you can set the compression

Packit 08bd4c
level used by gzip or xz compression:

Packit 08bd4c
Packit 08bd4c

tar -czf file.tar

Packit 08bd4c
--options=’compression-level=9’.

Packit 08bd4c
Packit 08bd4c

For more details, see the

Packit 08bd4c
explanation of the archive_read_set_options() and
Packit 08bd4c
archive_write_set_options() API calls that are
Packit 08bd4c
described in archive_read(3) and archive_write(3).

Packit 08bd4c
Packit 08bd4c

COMPATIBILITY

Packit 08bd4c
Packit 08bd4c

The bundled-arguments format is

Packit 08bd4c
supported for compatibility with historic implementations.
Packit 08bd4c
It consists of an initial word (with no leading - character)
Packit 08bd4c
in which each character indicates an option. Arguments
Packit 08bd4c
follow as separate words. The order of the arguments must
Packit 08bd4c
match the order of the corresponding characters in the
Packit 08bd4c
bundled command word. For example,

Packit 08bd4c
Packit 08bd4c

tar tbf 32

Packit 08bd4c
file.tar

Packit 08bd4c
Packit 08bd4c

specifies three flags t,

Packit 08bd4c
b, and f. The b and f flags both
Packit 08bd4c
require arguments, so there must be two additional items on
Packit 08bd4c
the command line. The 32 is the argument to the
Packit 08bd4c
b flag, and file.tar is the argument to the
Packit 08bd4c
f flag.

Packit 08bd4c
Packit 08bd4c

The mode options

Packit 08bd4c
c, r, t, u, and x and the options b, f, l, m, o, v, and w
Packit 08bd4c
comply with SUSv2.

Packit 08bd4c
Packit 08bd4c

For maximum

Packit 08bd4c
portability, scripts that invoke tar should use the
Packit 08bd4c
bundled-argument format above, should limit themselves to
Packit 08bd4c
the c, t, and x modes, and the
Packit 08bd4c
b, f, m, v, and w
Packit 08bd4c
options.

Packit 08bd4c
Packit 08bd4c

Additional long

Packit 08bd4c
options are provided to improve compatibility with other tar
Packit 08bd4c
implementations.

Packit 08bd4c
Packit 08bd4c

SECURITY

Packit 08bd4c
Packit 08bd4c

Certain security issues are

Packit 08bd4c
common to many archiving programs, including tar. In
Packit 08bd4c
particular, carefully-crafted archives can request that
Packit 08bd4c
tar extract files to locations outside of the target
Packit 08bd4c
directory. This can potentially be used to cause unwitting
Packit 08bd4c
users to overwrite files they did not intend to overwrite.
Packit 08bd4c
If the archive is being extracted by the superuser, any file
Packit 08bd4c
on the system can potentially be overwritten. There are
Packit 08bd4c
three ways this can happen. Although tar has
Packit 08bd4c
mechanisms to protect against each one, savvy users should
Packit 08bd4c
be aware of the implications:

Packit 08bd4c
Packit 08bd4c

Packit 08bd4c
Packit 08bd4c

Archive entries can have

Packit 08bd4c
absolute pathnames. By default, tar removes the
Packit 08bd4c
leading / character from filenames before restoring
Packit 08bd4c
them to guard against this problem.

Packit 08bd4c
Packit 08bd4c

Packit 08bd4c
Packit 08bd4c

Archive entries can have

Packit 08bd4c
pathnames that include .. components. By default,
Packit 08bd4c
tar will not extract files containing ..
Packit 08bd4c
components in their pathname.

Packit 08bd4c
Packit 08bd4c

Packit 08bd4c
Packit 08bd4c

Archive entries can exploit

Packit 08bd4c
symbolic links to restore files to other directories. An
Packit 08bd4c
archive can restore a symbolic link to another directory,
Packit 08bd4c
then use that link to restore a file into that directory. To
Packit 08bd4c
guard against this, tar checks each extracted path
Packit 08bd4c
for symlinks. If the final path element is a symlink, it
Packit 08bd4c
will be removed and replaced with the archive entry. If
Packit 08bd4c
-U is specified, any intermediate symlink will also
Packit 08bd4c
be unconditionally removed. If neither -U nor
Packit 08bd4c
-P is specified, tar will refuse to extract
Packit 08bd4c
the entry.

Packit 08bd4c
Packit 08bd4c

To protect yourself, you should

Packit 08bd4c
be wary of any archives that come from untrusted sources.
Packit 08bd4c
You should examine the contents of an archive with

Packit 08bd4c
Packit 08bd4c

tar -tf

Packit 08bd4c
filename

Packit 08bd4c
Packit 08bd4c

before extraction. You should

Packit 08bd4c
use the -k option to ensure that tar will not
Packit 08bd4c
overwrite any existing files or the -U option to
Packit 08bd4c
remove any pre-existing files. You should generally not
Packit 08bd4c
extract archives while running with super-user privileges.
Packit 08bd4c
Note that the -P option to tar disables the
Packit 08bd4c
security checks above and allows you to extract an archive
Packit 08bd4c
while preserving any absolute pathnames, ..
Packit 08bd4c
components, or symlinks to other directories.

Packit 08bd4c
Packit 08bd4c

SEE ALSO

Packit 08bd4c
Packit 08bd4c

bzip2(1), compress(1), cpio(1),

Packit 08bd4c
gzip(1), mt(1), pax(1), shar(1), xz(1), libarchive(3),
Packit 08bd4c
libarchive-formats(5), tar(5)

Packit 08bd4c
Packit 08bd4c

STANDARDS

Packit 08bd4c
Packit 08bd4c

There is no current POSIX

Packit 08bd4c
standard for the tar command; it appeared in ISO/IEC
Packit 08bd4c
9945-1:1996 (’’POSIX.1’’) but was
Packit 08bd4c
dropped from IEEE Std 1003.1-2001
Packit 08bd4c
(’’POSIX.1’’). The options supported
Packit 08bd4c
by this implementation were developed by surveying a number
Packit 08bd4c
of existing tar implementations as well as the old POSIX
Packit 08bd4c
specification for tar and the current POSIX specification
Packit 08bd4c
for pax.

Packit 08bd4c
Packit 08bd4c

The ustar and

Packit 08bd4c
pax interchange file formats are defined by IEEE Std
Packit 08bd4c
1003.1-2001 (’’POSIX.1’’) for the
Packit 08bd4c
pax command.

Packit 08bd4c
Packit 08bd4c

HISTORY

Packit 08bd4c
Packit 08bd4c

A tar command appeared in

Packit 08bd4c
Seventh Edition Unix, which was released in January, 1979.
Packit 08bd4c
There have been numerous other implementations, many of
Packit 08bd4c
which extended the file format. John Gilmore’s
Packit 08bd4c
pdtar public-domain implementation (circa November,
Packit 08bd4c
1987) was quite influential, and formed the basis of GNU
Packit 08bd4c
tar. GNU tar was included as the standard system tar in
Packit 08bd4c
FreeBSD beginning with FreeBSD 1.0.

Packit 08bd4c
Packit 08bd4c

This is a

Packit 08bd4c
complete re-implementation based on the libarchive(3)
Packit 08bd4c
library. It was first released with FreeBSD 5.4 in May,
Packit 08bd4c
2005.

Packit 08bd4c
Packit 08bd4c

BUGS

Packit 08bd4c
Packit 08bd4c

This program follows ISO/IEC

Packit 08bd4c
9945-1:1996 (’’POSIX.1’’) for the
Packit 08bd4c
definition of the -l option. Note that GNU tar prior
Packit 08bd4c
to version 1.15 treated -l as a synonym for the
Packit 08bd4c
--one-file-system option.

Packit 08bd4c
Packit 08bd4c

The -C

Packit 08bd4c
dir option may differ from historic
Packit 08bd4c
implementations.

Packit 08bd4c
Packit 08bd4c

All archive

Packit 08bd4c
output is written in correctly-sized blocks, even if the
Packit 08bd4c
output is being compressed. Whether or not the last output
Packit 08bd4c
block is padded to a full block size varies depending on the
Packit 08bd4c
format and the output device. For tar and cpio formats, the
Packit 08bd4c
last block of output is padded to a full block size if the
Packit 08bd4c
output is being written to standard output or to a character
Packit 08bd4c
or block device such as a tape drive. If the output is being
Packit 08bd4c
written to a regular file, the last block will not be
Packit 08bd4c
padded. Many compressors, including gzip(1) and bzip2(1),
Packit 08bd4c
complain about the null padding when decompressing an
Packit 08bd4c
archive created by tar, although they still extract
Packit 08bd4c
it correctly.

Packit 08bd4c
Packit 08bd4c

The compression

Packit 08bd4c
and decompression is implemented internally, so there may be
Packit 08bd4c
insignificant differences between the compressed output
Packit 08bd4c
generated by

Packit 08bd4c
Packit 08bd4c

tar -czf -

Packit 08bd4c
file

Packit 08bd4c
Packit 08bd4c

and that generated by

Packit 08bd4c
Packit 08bd4c

tar -cf - file |

Packit 08bd4c
gzip

Packit 08bd4c
Packit 08bd4c

The default

Packit 08bd4c
should be to read and write archives to the standard I/O
Packit 08bd4c
paths, but tradition (and POSIX) dictates otherwise.

Packit 08bd4c
Packit 08bd4c

The r and

Packit 08bd4c
u modes require that the archive be uncompressed and
Packit 08bd4c
located in a regular file on disk. Other archives can be
Packit 08bd4c
modified using c mode with the @archive-file
Packit 08bd4c
extension.

Packit 08bd4c
Packit 08bd4c

To archive a

Packit 08bd4c
file called @foo or -foo you must specify it
Packit 08bd4c
as ./@foo or ./-foo, respectively.

Packit 08bd4c
Packit 08bd4c

In create mode,

Packit 08bd4c
a leading ./ is always removed. A leading / is
Packit 08bd4c
stripped unless the -P option is specified.

Packit 08bd4c
Packit 08bd4c

There needs to

Packit 08bd4c
be better support for file selection on both create and
Packit 08bd4c
extract.

Packit 08bd4c
Packit 08bd4c

There is not yet

Packit 08bd4c
any support for multi-volume archives.

Packit 08bd4c
Packit 08bd4c

Converting

Packit 08bd4c
between dissimilar archive formats (such as tar and cpio)
Packit 08bd4c
using the @- convention can cause hard link
Packit 08bd4c
information to be lost. (This is a consequence of the
Packit 08bd4c
incompatible ways that different archive formats store
Packit 08bd4c
hardlink information.)

Packit 08bd4c
Packit 08bd4c

BSD

Packit 08bd4c
February 25, 2017 BSD

Packit 08bd4c

Packit 08bd4c
</body>
Packit 08bd4c
</html>