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.bz2

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 mag tapes!)

COMMON OPTIONS

-C, --directory DIR

change to directory DIR

-f, --file [HOSTNAME:]F

use archive file or device F (default "-", meaning stdin/stdout)

-j, --bzip2

filter archive through bzip2, use to decompress .bz2 files

-p, --preserve-permissions

extract all protection information

-v, --verbose

verbosely list files processed

-z, --gzip, --ungzip

filter the archive through gzip

ALL OPTIONS

--atime-preserve

don’t change access times on dumped files

-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

--check-links

warn if number of hard links to the file on the filesystem mismatch the number of links recorded in the archive

access the archive through PROG which is generally a compression program

--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 F

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

--exclude PATTERN

exclude files based upon PATTERN

-X, --exclude-from FILE

exclude files listed in FILE

-Z, --compress, --uncompress

filter the archive through compress

-z, --gzip, --gunzip, --ungzip

filter the archive through gzip

--use-compress-program PROG

filter the archive through PROG (which must accept -d)

-[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 was included in the Red Hat CVS 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 https://bugzilla.redhat.com

SEE ALSO

The full documentation for tar is maintained as a Texinfo manual. If the info and tar programs are properly installed at your site, the command