.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH TAR "1" "April 2024" "tar 1.35" "User Commands" .SH NAME A tar (tape archiver) program. .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 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\-\-delete\fR delete from the archive (not on mag tapes!) .TP \fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR find differences between archive and file system .TP \fB\-r\fR, \fB\-\-append\fR append files to the end of an archive .TP \fB\-\-test\-label\fR test the archive volume label and exit .TP \fB\-t\fR, \fB\-\-list\fR list the contents of an archive .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 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\-\-hole\-detection\fR=\fITYPE\fR technique to detect holes .TP \fB\-\-ignore\-failed\-read\fR do not exit with nonzero on unreadable files .TP \fB\-\-level\fR=\fINUMBER\fR dump level for created listed-incremental archive .TP \fB\-\-no\-check\-device\fR do not check device numbers when creating incremental archives .TP \fB\-\-no\-seek\fR archive is not seekable .TP \fB\-n\fR, \fB\-\-seek\fR archive is seekable .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 Local file name selection: .TP \fB\-\-add\-file\fR=\fIFILE\fR add given FILE to the archive (useful if its name starts with a dash) .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\-backups\fR exclude backup and lock files .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\-ignore\fR=\fIFILE\fR read exclude patterns for each directory from FILE, if it exists .TP \fB\-\-exclude\-ignore\-recursive\fR=\fIFILE\fR read exclude patterns for each directory and its subdirectories from FILE, if it exists .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\-\-exclude\-vcs\-ignores\fR read exclude patterns from the VCS ignore files .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 input file or member names .TP \fB\-\-no\-verbatim\-files\-from\fR \fB\-T\fR treats file names starting with dash as options (default) .TP \fB\-\-null\fR \fB\-T\fR reads null-terminated names; implies \fB\-\-verbatim\-files\-from\fR .TP \fB\-\-recursion\fR recurse into directories (default) .TP \fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR get names to extract or create from FILE .TP \fB\-\-unquote\fR unquote input file or member names (default) .TP \fB\-\-verbatim\-files\-from\fR \fB\-T\fR reads file names verbatim (no escape or option handling) .TP \fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR exclude patterns listed in FILE .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 for exclusion) .TP \fB\-\-wildcards\-match\-slash\fR wildcards match '/' (default for exclusion) .IP Overwrite control: .TP \fB\-\-keep\-directory\-symlink\fR preserve existing symlinks to directories when extracting .TP \fB\-\-keep\-newer\-files\fR don't replace existing files that are newer than their archive copies .TP \fB\-k\fR, \fB\-\-keep\-old\-files\fR don't replace existing files when extracting, treat them as errors .TP \fB\-\-no\-overwrite\-dir\fR preserve metadata of existing directories .TP \fB\-\-one\-top\-level\fR[=\fIDIR\fR] create a subdirectory to avoid having loose files extracted .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\-\-skip\-old\-files\fR don't replace existing files when extracting, silently skip over them .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 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\-\-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\-\-clamp\-mtime\fR only set time when the file is more recent than what was given with \fB\-\-mtime\fR .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\-\-group\-map\fR=\fIFILE\fR use FILE to map file owner GIDs and names .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\-delay\-directory\-restore\fR cancel the effect of \fB\-\-delay\-directory\-restore\fR option .TP \fB\-\-no\-same\-owner\fR extract files as yourself (default for ordinary users) .TP \fB\-\-no\-same\-permissions\fR apply the user's umask when extracting permissions from the archive (default for ordinary users) .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\-\-owner\-map\fR=\fIFILE\fR use FILE to map file owner UIDs and names .TP \fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR extract information about file permissions (default for superuser) .TP \fB\-\-same\-owner\fR try extracting files with the same ownership as exists in the archive (default for superuser) .TP \fB\-\-sort\fR=\fIORDER\fR directory sorting order: none (default), name or inode .TP \fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR member arguments are listed in the same order as the files in the archive .IP Handling of extended file attributes: .TP \fB\-\-acls\fR Enable the POSIX ACLs support .TP \fB\-\-no\-acls\fR Disable the POSIX ACLs support .TP \fB\-\-no\-selinux\fR Disable the SELinux context support .TP \fB\-\-no\-xattrs\fR Disable extended attributes support .TP \fB\-\-selinux\fR Enable the SELinux context support .TP \fB\-\-xattrs\fR Enable extended attributes support .TP \fB\-\-xattrs\-exclude\fR=\fIMASK\fR specify the exclude pattern for xattr keys .TP \fB\-\-xattrs\-include\fR=\fIMASK\fR specify the include pattern for xattr keys .IP Device selection and switching: .TP \fB\-\-force\-local\fR archive file is local even if it has a colon .TP \fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR use archive file or device ARCHIVE .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 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 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 Compression options: .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\-J\fR, \fB\-\-xz\fR filter the archive through xz .TP \fB\-\-lzip\fR filter the archive through lzip .TP \fB\-\-lzop\fR filter the archive through lzop .TP \fB\-\-no\-auto\-compress\fR do not use archive suffix to determine the compression program .TP \fB\-Y\fR, \fB\-\-lzma\fR filter the archive through xz \fB\-\-format\fR=\fIlzma\fR .TP \fB\-\-zstd\fR filter the archive through zstd .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 .IP Local file selection: .TP \fB\-\-backup\fR[=\fICONTROL\fR] backup before removal, choose version CONTROL .TP \fB\-\-hard\-dereference\fR follow hard links; archive and dump the files they refer to .TP \fB\-h\fR, \fB\-\-dereference\fR follow symlinks; archive and dump the files they point to .TP \fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\-NAME\fR begin at member MEMBER-NAME when reading the archive .TP \fB\-\-newer\-mtime\fR=\fIDATE\fR compare date and time when data changed only .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\-\-suffix\fR=\fISTRING\fR backup before removal, override usual suffix ('~' unless overridden by environment variable SIMPLE_BACKUP_SUFFIX) .IP 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 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\-\-full\-time\fR print file time to its full resolution .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\-snapshot\-field\-ranges\fR show valid ranges for snapshot-file fields .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 times in UTC .TP \fB\-v\fR, \fB\-\-verbose\fR verbosely list files processed .TP \fB\-\-warning\fR=\fIKEYWORD\fR warning control .TP \fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR ask for confirmation for every action .IP Compatibility options: .TP \fB\-o\fR when creating, same as \fB\-\-old\-archive\fR; when extracting, same as \fB\-\-no\-same\-owner\fR .IP 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 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 the \fB\-\-quoting\-style\fR option are: .IP literal shell shell-always shell-escape shell-escape-always c c-maybe escape locale clocale .PP *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/usr/sbin/rmt \fB\-\-rsh\-command=\fR/usr/bin/ssh .SH AUTHOR Written by John Gilmore and Jay Fenlason. .SH COPYRIGHT Copyright \(co 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . .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.