from small one page howto to huge articles all in one place
poll results
Last additions:
May 25th. 2007:
April, 26th. 2006:
| You are here: manpages
TAR
Section: tar (1) Updated: Mar 2010 Index
Return to Main Contents
NAME
tar - The GNU version of the tape archiver (tar) utility
SYNOPSIS
tar
<operation> [options]
Operations:
[-]A --catenate --concatenate
[-]c --create
[-]d --diff --compare
[-]r --append
[-]t --list
[-]u --update
[-]x --extract --get
--delete
Common Options:
-C, --directory DIR
-f, --file FILE
-j, --bzip2
-J, --xz
-p, --preserve-permissions
-v, --verbose
-z, --gzip
All Options:
[
-a, --auto-compress
]
[
--add-file FILE
]
[
--anchored
]
[
--atime-preserve
]
[
-b, --blocking-factor N
]
[
-B, --read-full-records
]
[
--backup BACKUP-TYPE
]
[
--block-compress
]
[
-C, --directory DIR
]
[
--checkpoint
]
[
--delay-directory-restore
]
[
--exclude PATTERN
]
[
--exclude-caches
]
[
--exclude-caches-all
]
[
--exclude-caches-under
]
[
--exclude-tag FILE
]
[
--exclude-tag-all FILE
]
[
--exclude-tag-under FILE
]
[
-f, --file [HOSTNAME:]FILE
]
[
-F, --info-script FILE, --new-volume-script FILE
]
[
--force-local
]
[
--format FORMAT
]
[
-g, --listed-incremental SNAPSHOT
]
[
-G, --incremental
]
[
--group GROUP
]
[
-h, --dereference
]
[
--help
]
[
-i, --ignore-zeros
]
[
-I, --use-compress-program PROG
]
[
--ignore-case
]
[
--ignore-command-error
]
[
--ignore-failed-read
]
[
--index-file FILE
]
[
-j, --bzip2
]
[
-J, --xz
]
[
-k, --keep-old-files
]
[
-K, --starting-file FILE
]
[
--keep-newer-files
]
[
-l, --check-links
]
[
-L, --tape-length N
]
[
--lzip
]
[
--lzma
]
[
--lzop
]
[
-m, --touch, --modification-time
]
[
-M, --multi-volume
]
[
--mode PERMISSIONS
]
[
--mtime DATE
]
[
-N, --after-date DATE, --newer DATE
]
[
--newer-mtime DATE
]
[
--no-anchored
]
[
--no-auto-compress
]
[
--no-delay-directory-restore
]
[
--no-ignore-case
]
[
--no-ignore-command-error
]
[
--no-overwrite-dir
]
[
--no-quote-chars
]
[
--no-recursion
]
[
--no-same-permissions
]
[
--no-unquote
]
[
--no-wildcards
]
[
--no-wildcards-match-slash
]
[
--null
]
[
--numeric-owner
]
[
-o, --old-archive, --portability, --no-same-owner
]
[
-O, --to-stdout
]
[
--occurrence NUM
]
[
--one-file-system
]
[
--overwrite
]
[
--overwrite-dir
]
[
--owner USER
]
[
-p, --same-permissions, --preserve-permissions
]
[
-P, --absolute-names
]
[
--pax-option KEYWORD-LIST
]
[
--posix
]
[
--preserve
]
[
--quote-chars STRING
]
[
--quote-style STYLE
]
[
-R, --block-number
]
[
--record-size SIZE
]
[
--recursion
]
[
--recursive-unlink
]
[
--remove-files
]
[
--restrict
]
[
--rmt-command CMD
]
[
--rsh-command CMD
]
[
-s, --same-order, --preserve-order
]
[
-S, --sparse
]
[
--same-owner
]
[
--show-defaults
]
[
--show-omitted-dirs
]
[
--show-transformed-names, --show-stored-names
]
[
--strip-components NUMBER
]
[
--suffix SUFFIX
]
[
-T, --files-from FILE
]
[
--test-label
]
[
--to-command COMMAND
]
[
--transform EXPRESSION
]
[
--totals
]
[
-U, --unlink-first
]
[
--unquote
]
[
--utc
]
[
-v, --verbose
]
[
-V, --label NAME
]
[
--version
]
[
--volno-file FILE
]
[
-w, --interactive, --confirmation
]
[
-W, --verify
]
[
--wildcards
]
[
--wildcards-match-slash
]
[
-X, --exclude-from FILE
]
[
-z, --gzip, --gunzip, --ungzip
]
[
-Z, --compress, --uncompress
]
[
-[0-7][lmh]
]
DESCRIPTION
This manual page documents the GNU version of tar, an archiving
program designed to store and extract files from an archive file known
as a tarfile. A tarfile may be made on a tape drive,
however, it is also common to write a tarfile to a normal file.
The first argument to tar must be one of the options Acdrtux,
followed by any optional functions. The final arguments to tar
are the names of the files or directories which should be archived. The
use of a directory name always implies that the subdirectories below
should be included in the archive.
EXAMPLES
- tar -xvf foo.tar
-
verbosely extract foo.tar
- tar -xzf foo.tar.gz
-
extract gzipped foo.tar.gz
- tar -cjf foo.tar.bz2 bar/
-
create bzipped tar archive of the directory bar called foo.tar.bz2
- tar -xjf foo.tar.bz2 -C bar/
-
extract bzipped foo.tar.bz2 after changing directory to bar
- tar -xzf foo.tar.gz blah.txt
-
extract the file blah.txt from foo.tar.gz
Note: When working with archives, specifying the compression option is often
times unnecessary as tar will automatically detect the compression type
based on the suffix of the archive.
FUNCTION LETTERS
- One of the following options must be used:
-
- -A, --catenate, --concatenate
-
append tar files to an archive
- -c, --create
-
create a new archive
- -d, --diff, --compare
-
find differences between archive and file system
- -r, --append
-
append files to the end of an archive
- -t, --list
-
list the contents of an archive
- -u, --update
-
only append files that are newer than the existing in archive
- -x, --extract, --get
-
extract files from an archive
- --delete
-
delete from the archive (not for use on magnetic tapes!)
COMMON OPTIONS
- -C, --directory DIR
-
change to directory DIR
- -f, --file [HOSTNAME:]FILE
-
use archive file or device FILE (default is "-", meaning stdin/stdout)
- -j, --bzip2
-
filter archive through bzip2; use to decompress .bz2 files
- -J, --xz
-
filter archive through xz; use to decompress .xz files
- -p, --preserve-permissions
-
extract all protection information
- -v, --verbose
-
verbosely list files processed
- -z, --gzip, --ungzip
-
filter the archive through gzip
ALL OPTIONS
- -a, --auto-compress
-
use archive suffix to determine the compression program
- --add-file FILE
-
add specified FILE to the archive (useful if FILE starts with a dash)
- --anchored
-
patterns will match the start of file names
- --atime-preserve
-
don't change access times of files that are archived
- -b, --blocking-factor N
-
block size of Nx512 bytes (default N=20)
- -B, --read-full-blocks
-
reblock as we read (for reading 4.2BSD pipes)
- --backup BACKUP-TYPE
-
backup files instead of deleting them using BACKUP-TYPE simple or
numbered
- --block-compress
-
block the output of compression program for tapes
- -C, --directory DIR
-
change to directory DIR
- --checkpoint
-
print directory names while reading the archive
- --delay-directory-restore
-
delay setting modification times and permissions of extracted directories
until the end of extraction
- --exclude PATTERN
-
exclude files based upon PATTERN
- --exclude-caches
-
exclude directories that contain a cache directory tag
- --exclude-tag FILE
-
exclude directories that contain a file named FILE
- -f, --file [HOSTNAME:]FILE
-
use archive file or device FILE (default "-", meaning stdin/stdout)
- -F, --info-script FILE, --new-volume-script FILE
-
run script at end of each tape (implies --multi-volume)
- --force-local
-
archive file is local even if its name contains a colon
- --format FORMAT
-
selects the format of the created archive
v7 - Unix V7
oldgnu - GNU tar <=1.12
gnu - GNU tar 1.13
ustar - POSIX.1-1988
posix - POSIX.1-2001
- -g, --listed-incremental SNAPSHOT
-
create/list/extract new GNU-format incremental backup
- --group GROUP
-
give files added to the archive a group id of GROUP instead of the group id
of the source file; this option does not affect extraction
- -G, --incremental
-
create/list/extract old GNU-format incremental backup
- -h, --dereference
-
don't archive symlinks; archive the files they point to
- --help
-
like this manpage, but not as cool
- -i, --ignore-zeros
-
ignore blocks of zeros in archive (normally mean EOF)
- -I, --use-compress-program PROG
-
access the archive through PROG (which is generally a compression program;
it must accept the -d option)
- --ignore-case
-
ignore case when excluding files
- --ignore-command-error
-
ignore exit codes of subprocesses
- --ignore-failed-read
-
don't exit with non-zero status on unreadable files
- --index-file FILE
-
send verbose output to FILE instead of stdout
- -j, --bzip2
-
filter archive through bzip2, use to decompress .bz2 files
- -J, --xz
-
filter archive through xz; use to decompress .xz files
- -k, --keep-old-files
-
keep existing files; don't overwrite them from archive
- -K, --starting-file FILE
-
begin at file FILE in the archive
- --keep-newer-files
-
do not overwrite files which are newer than the archive
- -l, --check-links
-
warn if number of hard links to the file on the filesystem mismatchs
the number of links recorded in the archive
- -L, --tape-length N
-
change tapes after writing N*1024 bytes
- -m, --touch, --modification-time
-
don't extract file modified time
- -M, --multi-volume
-
create/list/extract multi-volume archive
- --mode PERMISSIONS
-
apply PERMISSIONS while adding files (see chmod(1))
- --mtime DATE
-
when creating archives, use DATE as the modification time of the members,
instead of their actual modification times
- -N, --after-date DATE, --newer DATE
-
only store files that were modified or had status updates (permissions,
ACLs, extended attributes, ...) since DATE
- --newer-mtime DATE
-
like --newer, but only store files that were modified since DATE
- --no-anchored
-
match any subsequenceof the name's components with --exclude
- --no-auto-compress
-
do not use archive suffix to determine the compression program
- --no-delay-directory-restore
-
modification times and permissions of extracted directories are set when
all files from this directory have been extracted; this is the default
- --no-ignore-command-error
-
print warnings about subprocesses that terminated with a non-zero exit code
- --no-ignore-case
-
use case-sensitive matching with --exclude
- --no-overwrite-dir
-
preserve metadata of existing directories when extracting files from an
archive
- --no-quote-chars STRING
-
remove characters listed in STRING from the list of quoted characters
set by a previous --quote-chars option
- --no-recursion
-
don't recurse into directories
- --no-same-permissions
-
apply user's umask when extracting files instead of recorded permissions
- --no-unquote
-
treat all input file or member names literally, do not interpret
escape sequences
- --no-wildcards
-
don't use wildcards with --exclude
- --no-wildcards-match-slash
-
wildcards do not match slashes (/) with --exclude
- --null
-
--files-from reads null-terminated names, disable --directory
- --numeric-owner
-
always use numbers for user/group names
- -o, --old-archive, --portability
-
like --format=v7; -o exhibits this behavior when creating an
archive (deprecated behavior)
- -o, --no-same-owner
-
do not attempt to restore ownership when extracting; -o exhibits
this behavior when extracting an archive
- -O, --to-stdout
-
extract files to standard output
- --occurrence NUM
-
process only NUM occurrences of each named file; used with
--delete, --diff, --extract, or --list
- --one-file-system
-
stay in local file system when creating an archive
- --one-file-system
-
stay in local file system when creating an archive
- --overwrite
-
overwrite existing files and directory metadata when extracting
- --overwrite-dir
-
overwrite directory metadata when extracting
- --owner USER
-
give files added to the archive a user id of USER instead of the user id
of the source file; this option does not affect extraction
- -p, --preserve-permissions, --same-permissions
-
extract all protection information
- -P, --absolute-names
-
don't strip leading `/'s from file names
- --pax-option KEYWORD-LIST
-
used only with POSIX.1-2001 archives to modify the way tar handles
extended header keywords
- --posix
-
like --format=posix
- --preserve
-
like --preserve-permissions plus --same-order
- --quote-chars STRING
-
always quote the characters from STRING, even if the selected quoting
style would not quote them
- --quote-style STYLE
-
set the quoting style to be used when printing member and file names
- -R, --record-number
-
show record number within archive with each message
- --record-size SIZE
-
use SIZE bytes per record when accessing archives
- --recursion
-
recurse into directories
- --recursive-unlink
-
remove existing directories before extracting directories of the same name
- --remove-files
-
remove files after adding them to the archive
- --restrict
-
disable the use of some potentially harmful options; currently this
disables shell invocation from the multi-volume menu
- --rmt-command CMD
-
use CMD instead of the default /usr/sbin/rmt
- --rsh-command CMD
-
use remote CMD instead of rsh(1)
- -s, --same-order, --preserve-order
-
list of names to extract is sorted to match archive
- -S, --sparse
-
handle sparse files efficiently
- --same-owner
-
create extracted files with the same ownership
- --show-defaults
-
display the default options used by tar
- --show-omitted-dirs
-
print directories tar skips while operating on an archive
- --show-transformed-names, --show-stored-names
-
display file or member names after applying any sed transformations
- --strip-components NUMBER
-
strip NUMBER of leading path components from file names before extraction
- --suffix SUFFIX
-
use SUFFIX instead of default '~' when backing up files
- -T, --files-from FILE
-
get names to extract or create from file FILE
- --test-label
-
read the volume label; if an argument is specified, test whether it
matches the volume label
- --to-command COMMAND
-
during extraction, pipe extracted files to the standard input of COMMAND
- --totals
-
print total bytes written with --create
- --transform EXPRESSION
-
transform file or member names using the sed replacement expression
EXPRESSION
- -U, --unlink-first
-
remove existing files before extracting files of the same name
- --unquote
-
enable unquoting input file or member names; this is the default
- --utc
-
display file modification dates in UTC
- -v, --verbose
-
verbosely list files processed
- -V, --label NAME
-
create archive with volume name NAME
- --version
-
print tar program version number
- --volno-file FILE
-
keep track of which volume of a multi-volume archive its working in
FILE; used with --multi-volume
- -w, --interactive, --confirmation
-
ask for confirmation for every action
- -W, --verify
-
attempt to verify the archive after writing it
- --wildcards
-
use wildcards with --exclude
- --wildcards-match-slash
-
wildcards match slashes (/) with --exclude
- -X, --exclude-from FILE
-
exclude files listed in FILE
- -z, --gzip, --gunzip, --ungzip
-
filter the archive through gzip
- -Z, --compress, --uncompress
-
filter the archive through compress
- -[0-7][lmh]
-
specify drive and density
BUGS
The GNU folks, in general, abhor man pages and create info documents instead.
The maintainer of tar falls into this category. Thus, this man page may
not be complete nor current, and it is included in the Gentoo portage tree
because man is a great tool :). This man page was first taken from Debian
Linux and has since been lovingly updated here.
REPORTING BUGS
Please report bugs via http://bugs.gentoo.org/
AUTHORS
Debian Linux http://www.debian.org/
Mike Frysinger <vapier@gentoo.org>
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- EXAMPLES
-
- FUNCTION LETTERS
-
- COMMON OPTIONS
-
- ALL OPTIONS
-
- BUGS
-
- REPORTING BUGS
-
- AUTHORS
-
Please read "Why adblockers are badwww.cars2fast4u.de
|
Other free services .
.
|