1 .TH TAR 1 "Oct 2004" "GNU" "tar"
3 tar \- The GNU version of the tar archiving utility
6 .I <operation> [options]
10 .B [-]A --catenate --concatenate
12 .B [-]d --diff --compare
16 .B [-]x --extract --get
22 .B -C, --directory DIR
25 .B -p, --preserve-permissions
36 .B -b, --blocking-factor N
39 .B -B, --read-full-records
42 .B --backup BACKUP-TYPE
48 .B -C, --directory DIR
57 .B -f, --file [HOSTNAME:]F
60 .B -F, --info-script F --new-volume-script F
69 .B -g, --listed-incremental F
90 .B --ignore-failed-read
99 .B -k, --keep-old-files
102 .B -K, --starting-file F
105 .B --keep-newer-files
111 .B -L, --tape-length N
114 .B -m, --touch, --modification-time
117 .B -M, --multi-volume
120 .B --mode PERMISSIONS
123 .B -N, --after-date DATE, --newer DATE
126 .B --newer-mtime DATE
138 .B --no-same-permissions
144 .B --no-wildcards-match-slash
153 .B -o, --old-archive, --portability, --no-same-owner
159 .B --occurrence[=NUM]
171 .B -p, --same-permissions, --preserve-permissions
174 .B -P, --absolute-names
177 .B --pax-option KEYWORD-LIST
204 .B -R, --block-number
207 .B --record-size SIZE
213 .B --recursive-unlink
225 .B -s, --same-order, --preserve-order
237 .B --show-omitted-dirs
240 .B --strip-components NUMBER, --strip-path NUMBER (1)
246 .B -T, --files-from F
252 .B -U, --unlink-first
255 .B --use-compress-program PROG
273 .B -w, --interactive, --confirmation
282 .B --wildcards-match-slash
288 .B -X, --exclude-from FILE
291 .B -Z, --compress, --uncompress
294 .B -z, --gzip, --gunzip, --ungzip
300 (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
302 This manual page documents the GNU version of \fBtar\fR, an archiving
303 program designed to store and extract files from an archive file known
304 as a \fItarfile\fR. A \fItarfile\fR may be made on a tape drive,
305 however, it is also common to write a \fItarfile\fR to a normal file.
306 The first argument to \fBtar\fR must be one of the options \fBAcdrtux\fR,
307 followed by any optional functions. The final arguments to \fBtar\fR
308 are the names of the files or directories which should be archived. The
309 use of a directory name always implies that the subdirectories below
310 should be included in the archive.
314 verbosely extract foo.tar
316 .B tar -xzf foo.tar.gz
317 extract gzipped foo.tar.gz
319 .B tar -cjf foo.tar.bz2 bar/
320 create bzipped tar archive of the directory bar called foo.tar.bz2
322 .B tar -xjf foo.tar.bz2 -C bar/
323 extract bzipped foo.tar.bz2 after changing directory to bar
325 .B tar -xzf foo.tar.gz blah.txt
326 extract the file blah.txt from foo.tar.gz
327 .SH "FUNCTION LETTERS"
329 .B One of the following options must be used:
331 .B -A, --catenate, --concatenate
332 append tar files to an archive
337 .B -d, --diff, --compare
338 find differences between archive and file system
341 append files to the end of an archive
344 list the contents of an archive
347 only append files that are newer than the existing in archive
349 .B -x, --extract, --get
350 extract files from an archive
353 delete from the archive (not for use on mag tapes!)
356 .B -C, --directory DIR
357 change to directory DIR
359 .B -f, --file [HOSTNAME:]F
360 Use archive file or device F (default "-", meaning stdin/stdout).
361 Note that "/dev/stdout" is not equivalent to "-". Using "/dev/stdout"
362 explicitly can lead to corrupted archive, especially when coupled with "-v".
365 filter archive through bzip2, use to decompress .bz2 files
367 .B -p, --preserve-permissions
368 extract all protection information
371 verbosely list files processed
373 .B -z, --gzip, --ungzip
374 filter the archive through gzip
378 don't change access times on dumped files
380 .B -b, --blocking-factor N
381 block size of Nx512 bytes (default N=20)
383 .B -B, --read-full-blocks
384 reblock as we read (for reading 4.2BSD pipes)
386 .B --backup BACKUP-TYPE
387 backup files instead of deleting them using BACKUP-TYPE simple or
391 block the output of compression program for tapes
393 .B -C, --directory DIR
394 change to directory DIR
397 warn if number of hard links to the file on the filesystem mismatch the
398 number of links recorded in the archive
401 print directory names while reading the archive
403 .B -f, --file [HOSTNAME:]F
404 Use archive file or device F (default "-", meaning stdin/stdout).
405 Note that "/dev/stdout" is not equivalent to "-". Using "/dev/stdout"
406 explicitly can lead to corrupted archive, especially when coupled with "-v".
408 .B -F, --info-script F --new-volume-script F
409 run script at end of each tape (implies \fI--multi-volume\fR)
412 archive file is local even if has a colon
415 selects output archive format
418 \fIoldgnu\fR - GNU tar <=1.12
419 \fIgnu\fR - GNU tar 1.13
420 \fIustar\fR - POSIX.1-1988
421 \fIposix\fR - POSIX.1-2001
424 .B -g, --listed-incremental F
425 create/list/extract new GNU-format incremental backup
428 create/list/extract old GNU-format incremental backup
431 don't dump symlinks; dump the files they point to
434 like this manpage, but not as cool
436 .B -i, --ignore-zeros
437 ignore blocks of zeros in archive (normally mean EOF)
440 ignore case when excluding files
442 .B --ignore-failed-read
443 don't exit with non-zero status on unreadable files
446 send verbose output to FILE instead of stdout
449 filter archive through bzip2, use to decompress .bz2 files
451 .B -k, --keep-old-files
452 keep existing files; don't overwrite them from archive
454 .B -K, --starting-file F
455 begin at file F in the archive
457 .B --keep-newer-files
458 do not overwrite files which are newer than the archive
461 stay in local file system when creating an archive
463 .B -L, --tape-length N
464 change tapes after writing N*1024 bytes
466 .B -m, --touch, --modification-time
467 don't extract file modified time
469 .B -M, --multi-volume
470 create/list/extract multi-volume archive
472 .B --mode PERMISSIONS
473 apply PERMISSIONS while adding files (see \fBchmod\fR(1))
475 .B -N, --after-date DATE, --newer DATE
476 only store files newer than DATE
478 .B --newer-mtime DATE
479 like \fI--newer\fR, but with a DATE
482 match any subsequenceof the name's components with \fI--exclude\fR
485 use case-sensitive matching with \fI--exclude\fR
488 don't recurse into directories
490 .B --no-same-permissions
491 apply user's umask when extracting files instead of recorded permissions
494 don't use wildcards with \fI--exclude\fR
496 .B --no-wildcards-match-slash
497 wildcards do not match slashes (/) with \fI--exclude\fR
500 \fI--files-from\fR reads null-terminated names, disable \fI--directory\fR
503 always use numbers for user/group names
505 .B -o, --old-archive, --portability
506 like \fI--format=v7\fR; \fI-o\fR exhibits this behavior when creating an
507 archive (deprecated behavior)
509 .B -o, --no-same-owner
510 do not attempt to restore ownership when extracting; \fI-o\fR exhibits
511 this behavior when extracting an archive
514 extract files to standard output
516 .B --occurrence[=NUM]
517 process only the NUMth occurrence of each named file; used with
518 \fI--delete\fR, \fI--diff\fR, \fI--extract\fR, or \fI--list\fR.
522 overwrite existing files and directory metadata when extracting
525 overwrite directory metadata when extracting
528 change owner of extraced files to USER
530 .B -p, --same-permissions, --preserve-permissions
531 extract all protection information
533 .B -P, --absolute-names
534 don't strip leading `/'s from file names
536 .B --pax-option KEYWORD-LIST
537 used only with POSIX.1-2001 archives to modify the way \fBtar\fR handles
538 extended header keywords
541 like \fI--format=posix\fR
544 like \fI--preserve-permissions\fR \fI--same-order\fR
547 this option causes \fBtar\fR to store each file's ACLs in the archive.
550 this option causes \fBtar\fR to store each file's SELinux security context information in the archive.
553 this option causes \fBtar\fR to store each file's extended attributes in the archive. This option also enables \fI--acls\fR and\fI--selinux\fR if they haven't been set already, due to the fact that the data for those are stored in special xattrs.
556 This option causes \fBtar\fR not to store each file's ACLs in the archive and not to extract any ACL information in an archive.
559 this option causes \fBtar\fR not to store each file's SELinux security context information in the archive and not to extract any SELinux information in an archive.
562 this option causes \fBtar\fR not to store each file's extended attributes in the archive and not to extract any extended attributes in an archive. This option also enables \fI--no-acls\fR and \fI--no-selinux\fR if they haven't been set already.
564 .B -R, --record-number
565 show record number within archive with each message
567 .B --record-size SIZE
568 use SIZE bytes per record when accessing archives
571 recurse into directories
573 .B --recursive-unlink
574 remove existing directories before extracting directories of the same name
577 remove files after adding them to the archive
580 use CMD instead of the default /usr/sbin/rmt
583 use remote CMD instead of \fBrsh\fR(1)
585 .B -s, --same-order, --preserve-order
586 list of names to extract is sorted to match archive
589 handle sparse files efficiently
592 create extracted files with the same ownership
595 display the default options used by \fBtar\fR
597 .B --show-omitted-dirs
598 print directories \fBtar\fR skips while operating on an archive
600 .B --strip-components NUMBER, --strip-path NUMBER
601 strip NUMBER of leading components from file names before extraction
603 (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
606 use SUFFIX instead of default '~' when backing up files
608 .B -T, --files-from F
609 get names to extract or create from file F
612 print total bytes written with --create
614 .B -U, --unlink-first
615 remove existing files before extracting files of the same name
617 .B --use-compress-program PROG
618 access the archive through PROG which is generally a compression program
621 display file modification dates in UTC
624 verbosely list files processed
627 create archive with volume name NAME
630 print \fBtar\fR program version number
633 keep track of which volume of a multi-volume archive its working in
634 FILE; used with \fI--multi-volume\fR
636 .B -w, --interactive, --confirmation
637 ask for confirmation for every action
640 attempt to verify the archive after writing it
643 use wildcards with \fI--exclude\fR
645 .B --wildcards-match-slash
646 wildcards match slashes (/) with \fI--exclude\fR
649 exclude files based upon PATTERN
651 .B -X, --exclude-from FILE
652 exclude files listed in FILE
654 .B -Z, --compress, --uncompress
655 filter the archive through compress
657 .B -z, --gzip, --gunzip, --ungzip
658 filter the archive through gzip
660 .B --use-compress-program PROG
661 filter the archive through PROG (which must accept -d)
664 specify drive and density
666 The GNU folks, in general, abhor man pages, and create info documents instead.
667 The maintainer of \fBtar\fR falls into this category. Thus this man page may
668 not be complete, nor current, and was included in the Red Hat CVS tree
669 because man is a great tool :). This man page was first taken from Debian
670 Linux and has since been loving updated here.
672 Please report bugs via https://bugzilla.redhat.com
674 The full documentation for
676 is maintained as a Texinfo manual. If the
680 programs are properly installed at your site, the command
684 should give you access to the complete manual.
687 Debian Linux http://www.debian.org/
688 Mike Frysinger <vapier@gentoo.org>