tar/tar.1
2009-11-27 14:09:58 +00:00

601 lines
15 KiB
Groff

.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
.TH TAR "1" "November 2009" "tar 1.22" "User Commands"
.SH NAME
tar \- manual page for tar 1.22
.SH SYNOPSIS
.B tar
[\fIOPTION\fR...] [\fIFILE\fR]...
.SH DESCRIPTION
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.
.SH EXAMPLES
.TP
tar \fB\-cf\fR archive.tar foo bar
# Create archive.tar from files foo and bar.
.TP
tar \fB\-tvf\fR archive.tar
# List all files in archive.tar verbosely.
.TP
tar \fB\-xf\fR archive.tar
# Extract all files from archive.tar.
.IP
.SH OPTIONS
.SH Main operation mode:
.TP
\fB\-A\fR, \fB\-\-catenate\fR, \fB\-\-concatenate\fR
append tar files to an archive
.TP
\fB\-c\fR, \fB\-\-create\fR
create a new archive
.TP
\fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR
find differences between archive and file system
.TP
\fB\-\-delete\fR
delete from the archive (not on mag tapes!)
.TP
\fB\-r\fR, \fB\-\-append\fR
append files to the end of an archive
.TP
\fB\-t\fR, \fB\-\-list\fR
list the contents of an archive
.TP
\fB\-\-test\-label\fR
test the archive volume label and exit
.TP
\fB\-u\fR, \fB\-\-update\fR
only append files newer than copy in archive
.TP
\fB\-x\fR, \fB\-\-extract\fR, \fB\-\-get\fR
extract files from an archive
.IP
.SH\fBCommon Options:\fR
.TP
\fB-C\fR, \fB--directory=DIR\fR
change to directory DIR
.TP
\fB-f\fR, \fB--file=ARCHIVE\fR
use archive file or device ARCHIVE
.TP
\fB-j\fR, \fB--bzip2\fR
filter the archive through bzip2
.TP
\fB -J\fR, \fB--xz\fR
filter the archive through xz
.TP
\fB-p\fR, \fB--preserve-permissions\fR
extract information about file permissions (default for superuser)
.TP
\fB-v\fR, \fB--verbose\fR
verbosely list files processed
.TP
\fB-z\fR, \fB--gzip\fR
filter the archive through gzip
.SH Operation modifiers:
.TP
\fB\-\-check\-device\fR
check device numbers when creating incremental
archives (default)
.TP
\fB\-g\fR, \fB\-\-listed\-incremental\fR=\fIFILE\fR
handle new GNU\-format incremental backup
.TP
\fB\-G\fR, \fB\-\-incremental\fR
handle old GNU\-format incremental backup
.TP
\fB\-\-ignore\-failed\-read\fR
do not exit with nonzero on unreadable files
.TP
\fB\-n\fR, \fB\-\-seek\fR
archive is seekable
.TP
\fB\-\-no\-check\-device\fR
do not check device numbers when creating
incremental archives
.TP
\fB\-\-occurrence\fR[=\fINUMBER\fR]
process only the NUMBERth occurrence of each file
in the archive; this option is valid only in
conjunction with one of the subcommands \fB\-\-delete\fR,
\fB\-\-diff\fR, \fB\-\-extract\fR or \fB\-\-list\fR and when a list of
files is given either on the command line or via
the \fB\-T\fR option; NUMBER defaults to 1
.TP
\fB\-\-sparse\-version\fR=\fIMAJOR[\fR.MINOR]
set version of the sparse format to use (implies
\fB\-\-sparse\fR)
.TP
\fB\-S\fR, \fB\-\-sparse\fR
handle sparse files efficiently
.IP
.SH Overwrite control:
.TP
\fB\-k\fR, \fB\-\-keep\-old\-files\fR
don't replace existing files when extracting
.TP
\fB\-\-keep\-newer\-files\fR
don't replace existing files that are newer than
their archive copies
.TP
\fB\-\-no\-overwrite\-dir\fR
preserve metadata of existing directories
.TP
\fB\-\-overwrite\fR
overwrite existing files when extracting
.TP
\fB\-\-overwrite\-dir\fR
overwrite metadata of existing directories when
extracting (default)
.TP
\fB\-\-recursive\-unlink\fR
empty hierarchies prior to extracting directory
.TP
\fB\-\-remove\-files\fR
remove files after adding them to the archive
.TP
\fB\-U\fR, \fB\-\-unlink\-first\fR
remove each file prior to extracting over it
.TP
\fB\-W\fR, \fB\-\-verify\fR
attempt to verify the archive after writing it
.IP
.SH Select output stream:
.HP
\fB\-\-ignore\-command\-error\fR ignore exit codes of children
.TP
\fB\-\-no\-ignore\-command\-error\fR
treat non\-zero exit codes of children as
error
.TP
\fB\-O\fR, \fB\-\-to\-stdout\fR
extract files to standard output
.TP
\fB\-\-to\-command\fR=\fICOMMAND\fR
pipe extracted files to another program
.IP
Handling of file attributes:
.TP
\fB\-\-acls\fR
Save the ACLs to the archive
.TP
\fB\-\-atime\-preserve\fR[=\fIMETHOD\fR]
preserve access times on dumped files, either
by restoring the times after reading
(METHOD='replace'; default) or by not setting the
times in the first place (METHOD='system')
.TP
\fB\-\-delay\-directory\-restore\fR
delay setting modification times and
permissions of extracted directories until the end
of extraction
.TP
\fB\-\-group\fR=\fINAME\fR
force NAME as group for added files
.TP
\fB\-\-mode\fR=\fICHANGES\fR
force (symbolic) mode CHANGES for added files
.TP
\fB\-\-mtime\fR=\fIDATE\-OR\-FILE\fR
set mtime for added files from DATE\-OR\-FILE
.TP
\fB\-m\fR, \fB\-\-touch\fR
don't extract file modified time
.TP
\fB\-\-no\-acls\fR
Don't extract the ACLs from the archive
.TP
\fB\-\-no\-delay\-directory\-restore\fR
cancel the effect of \fB\-\-delay\-directory\-restore\fR
option
.TP
\fB\-\-no\-same\-owner\fR
extract files as yourself
.TP
\fB\-\-no\-same\-permissions\fR
apply the user's umask when extracting permissions
from the archive (default for ordinary users)
.TP
\fB\-\-no\-selinux\fR
Don't extract the SELinux context from the archive
.TP
\fB\-\-no\-xattrs\fR
Don't extract the user/root xattrs from the
archive
.TP
\fB\-\-numeric\-owner\fR
always use numbers for user/group names
.TP
\fB\-\-owner\fR=\fINAME\fR
force NAME as owner for added files
.TP
\fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR
extract information about file permissions
(default for superuser)
.TP
\fB\-\-preserve\fR
same as both \fB\-p\fR and \fB\-s\fR
.TP
\fB\-\-same\-owner\fR
try extracting files with the same ownership
.TP
\fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR
sort names to extract to match archive
.TP
\fB\-\-selinux\fR
Save the SELinux context to the archive
.TP
\fB\-\-xattrs\fR
Save the user/root xattrs to the archive
.IP
.SH Device selection and switching:
.TP
\fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR
use archive file or device ARCHIVE
.TP
\fB\-\-force\-local\fR
archive file is local even if it has a colon
.TP
\fB\-F\fR, \fB\-\-info\-script\fR=\fINAME\fR, \fB\-\-new\-volume\-script\fR=\fINAME\fR
run script at end of each tape (implies \fB\-M\fR)
.TP
\fB\-L\fR, \fB\-\-tape\-length\fR=\fINUMBER\fR
change tape after writing NUMBER x 1024 bytes
.TP
\fB\-M\fR, \fB\-\-multi\-volume\fR
create/list/extract multi\-volume archive
.TP
\fB\-\-rmt\-command\fR=\fICOMMAND\fR
use given rmt COMMAND instead of rmt
.TP
\fB\-\-rsh\-command\fR=\fICOMMAND\fR
use remote COMMAND instead of rsh
.TP
\fB\-\-volno\-file\fR=\fIFILE\fR
use/update the volume number in FILE
.IP
.SH Device blocking:
.TP
\fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR
BLOCKS x 512 bytes per record
.TP
\fB\-B\fR, \fB\-\-read\-full\-records\fR
reblock as we read (for 4.2BSD pipes)
.TP
\fB\-i\fR, \fB\-\-ignore\-zeros\fR
ignore zeroed blocks in archive (means EOF)
.TP
\fB\-\-record\-size\fR=\fINUMBER\fR
NUMBER of bytes per record, multiple of 512
.IP
.SH Archive format selection:
.TP
\fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR
create archive of the given format
.IP
FORMAT is one of the following:
.TP
gnu
GNU tar 1.13.x format
.TP
oldgnu
GNU format as per tar <= 1.12
.TP
pax
POSIX 1003.1\-2001 (pax) format
.TP
posix
same as pax
.TP
ustar
POSIX 1003.1\-1988 (ustar) format
.TP
v7
old V7 tar format
.TP
\fB\-\-old\-archive\fR, \fB\-\-portability\fR
same as \fB\-\-format\fR=\fIv7\fR
.TP
\fB\-\-pax\-option\fR=\fIkeyword[[\fR:]=value][,keyword[[:]=value]]...
control pax keywords
.TP
\fB\-\-posix\fR
same as \fB\-\-format\fR=\fIposix\fR
.TP
\fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR
create archive with volume name TEXT; at
list/extract time, use TEXT as a globbing pattern
for volume name
.IP
\fBCompression options:\fR
.TP
\fB\-a\fR, \fB\-\-auto\-compress\fR
use archive suffix to determine the compression
program
.TP
\fB\-I\fR, \fB\-\-use\-compress\-program\fR=\fIPROG\fR
filter through PROG (must accept \fB\-d\fR)
.TP
\fB\-j\fR, \fB\-\-bzip2\fR
filter the archive through bzip2
.TP
\fB\-\-lzma\fR
filter the archive through lzma
.TP
\fB\-\-no\-auto\-compress\fR
do not use archive suffix to determine the
compression program
.TP
\fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR
filter the archive through gzip
.TP
\fB\-Z\fR, \fB\-\-compress\fR, \fB\-\-uncompress\fR
filter the archive through compress
.TP
\fB\-J\fR, \fB\-\-xz\fR
filter the archive through xz
.TP
\fB\-\-lzop\fR
filter the archive through lzop
.IP
.SH Local file selection:
.TP
\fB\-\-add\-file\fR=\fIFILE\fR
add given FILE to the archive (useful if its name
starts with a dash)
.TP
\fB\-\-backup\fR[=\fICONTROL\fR]
backup before removal, choose version CONTROL
.TP
\fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
change to directory DIR
.TP
\fB\-\-exclude\fR=\fIPATTERN\fR
exclude files, given as a PATTERN
.TP
\fB\-\-exclude\-caches\fR
exclude contents of directories containing
CACHEDIR.TAG, except for the tag file itself
.TP
\fB\-\-exclude\-caches\-all\fR
exclude directories containing CACHEDIR.TAG
.TP
\fB\-\-exclude\-caches\-under\fR exclude everything under directories containing
CACHEDIR.TAG
.TP
\fB\-\-exclude\-tag\fR=\fIFILE\fR
exclude contents of directories containing FILE,
except for FILE itself
.HP
\fB\-\-exclude\-tag\-all\fR=\fIFILE\fR exclude directories containing FILE
.TP
\fB\-\-exclude\-tag\-under\fR=\fIFILE\fR
exclude everything under directories
containing FILE
.TP
\fB\-\-exclude\-vcs\fR
exclude version control system directories
.TP
\fB\-h\fR, \fB\-\-dereference\fR
follow symlinks; archive and dump the files they
point to
.TP
\fB\-\-hard\-dereference\fR
follow hard links; archive and dump the files they
refer to
.TP
\fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\-NAME\fR
begin at member MEMBER\-NAME in the archive
.TP
\fB\-\-newer\-mtime\fR=\fIDATE\fR
compare date and time when data changed only
.TP
\fB\-\-no\-null\fR
disable the effect of the previous \fB\-\-null\fR option
.TP
\fB\-\-no\-recursion\fR
avoid descending automatically in directories
.TP
\fB\-\-no\-unquote\fR
do not unquote filenames read with \fB\-T\fR
.HP
\fB\-\-null\fR \fB\-T\fR reads null\-terminated names, disable \fB\-C\fR
.TP
\fB\-N\fR, \fB\-\-newer\fR=\fIDATE\-OR\-FILE\fR, \fB\-\-after\-date\fR=\fIDATE\-OR\-FILE\fR
only store files newer than DATE\-OR\-FILE
.TP
\fB\-\-one\-file\-system\fR
stay in local file system when creating archive
.TP
\fB\-P\fR, \fB\-\-absolute\-names\fR
don't strip leading `/'s from file names
.TP
\fB\-\-recursion\fR
recurse into directories (default)
.TP
\fB\-\-suffix\fR=\fISTRING\fR
backup before removal, override usual suffix ('~'
unless overridden by environment variable
SIMPLE_BACKUP_SUFFIX)
.TP
\fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR
get names to extract or create from FILE
.TP
\fB\-\-unquote\fR
unquote filenames read with \fB\-T\fR (default)
.TP
\fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
exclude patterns listed in FILE
.IP
.SH File name transformations:
.TP
\fB\-\-strip\-components\fR=\fINUMBER\fR
strip NUMBER leading components from file
names on extraction
.TP
\fB\-\-transform\fR=\fIEXPRESSION\fR, \fB\-\-xform\fR=\fIEXPRESSION\fR
use sed replace EXPRESSION to transform file
names
.IP
File name matching options (affect both exclude and include patterns):
.TP
\fB\-\-anchored\fR
patterns match file name start
.TP
\fB\-\-ignore\-case\fR
ignore case
.TP
\fB\-\-no\-anchored\fR
patterns match after any `/' (default for
exclusion)
.TP
\fB\-\-no\-ignore\-case\fR
case sensitive matching (default)
.TP
\fB\-\-no\-wildcards\fR
verbatim string matching
.TP
\fB\-\-no\-wildcards\-match\-slash\fR
wildcards do not match `/'
.TP
\fB\-\-wildcards\fR
use wildcards (default)
.TP
\fB\-\-wildcards\-match\-slash\fR
wildcards match `/' (default for exclusion)
.IP
Informative output:
.TP
\fB\-\-checkpoint\fR[=\fINUMBER\fR]
display progress messages every NUMBERth record
(default 10)
.TP
\fB\-\-checkpoint\-action\fR=\fIACTION\fR
execute ACTION on each checkpoint
.TP
\fB\-\-index\-file\fR=\fIFILE\fR
send verbose output to FILE
.TP
\fB\-l\fR, \fB\-\-check\-links\fR
print a message if not all links are dumped
.TP
\fB\-\-no\-quote\-chars\fR=\fISTRING\fR
disable quoting for characters from STRING
.TP
\fB\-\-quote\-chars\fR=\fISTRING\fR
additionally quote characters from STRING
.TP
\fB\-\-quoting\-style\fR=\fISTYLE\fR
set name quoting style; see below for valid STYLE
values
.TP
\fB\-R\fR, \fB\-\-block\-number\fR
show block number within archive with each
message
.TP
\fB\-\-show\-defaults\fR
show tar defaults
.TP
\fB\-\-show\-omitted\-dirs\fR
when listing or extracting, list each directory
that does not match search criteria
.TP
\fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR
show file or archive names after transformation
.TP
\fB\-\-totals\fR[=\fISIGNAL\fR]
print total bytes after processing the archive;
with an argument \- print total bytes when this
SIGNAL is delivered; Allowed signals are: SIGHUP,
SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names
without SIG prefix are also accepted
.TP
\fB\-\-utc\fR
print file modification dates in UTC
.TP
\fB\-v\fR, \fB\-\-verbose\fR
verbosely list files processed
.TP
\fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR
ask for confirmation for every action
.IP
.SH Compatibility options:
.TP
\fB\-o\fR
when creating, same as \fB\-\-old\-archive\fR; when
extracting, same as \fB\-\-no\-same\-owner\fR
.IP
.SH Other options:
.TP
\-?, \fB\-\-help\fR
give this help list
.TP
\fB\-\-restrict\fR
disable use of some potentially harmful options
.TP
\fB\-\-usage\fR
give a short usage message
.TP
\fB\-\-version\fR
print program version
.PP
.PP
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
.PP
The backup suffix is `~', unless set with \fB\-\-suffix\fR or SIMPLE_BACKUP_SUFFIX.
The version control may be set with \fB\-\-backup\fR or VERSION_CONTROL, values are:
.TP
none, off
never make backups
.TP
t, numbered
make numbered backups
.TP
nil, existing
numbered if numbered backups exist, simple otherwise
.TP
never, simple
always make simple backups
.PP
Valid arguments for \fB\-\-quoting\-style\fR options are:
.IP
literal
shell
shell\-always
c
c\-maybe
escape
locale
clocale
.PP
.SH DEFAULTS
*This* tar defaults to:
\fB\-\-format\fR=\fIgnu\fR \fB\-f\-\fR \fB\-b20\fR \fB\-\-quoting\-style\fR=\fIescape\fR \fB\-\-rmt\-command=\fR/sbin/rmt
\fB\-\-rsh\-command=\fR/usr/bin/rsh
.SH AUTHOR
Written by John Gilmore and Jay Fenlason.
.SH "REPORTING BUGS"
Report bugs to <bug\-tar@gnu.org>.
.SH COPYRIGHT
Copyright \(co 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
The full documentation for
.B tar
is maintained as a Texinfo manual. If the
.B info
and
.B tar
programs are properly installed at your site, the command
.IP
.B info tar
.PP
should give you access to the complete manual.