Command: gnu tar
GNU "TAR" saves many files together into a single tape or disk archive,
and can restore individual files from the archive.
Syntax:
tar [OPTION]... [FILE]...
If a long option shows an argument as mandatory, then it is mandatory
for the equivalent short option also. Similarly for optional argu-
ments.
Options:
Main operation mode:
-t, --list List the contents of an archive
-x, --extract, --get Extract files from 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
-u, --update Only append files newer than copy in archive
-A, --catenate Append tar files to an archive
--concatenate Same as -A
--delete Delete from the archive (not on mag tapes!)
Operation modifiers:
-W, --verify Attempt to verify the archive after writing
it
--remove-files Remove files after adding them to the archive
-k, --keep-old-files Don't overwrite existing files when extrac-
ting
-U, --unlink-first Remove each file prior to extracting over it
--recursive-unlink Empty hierarchies prior to extracting direc-
tory
-S, --sparse Handle sparse files efficiently
-O, --to-stdout Extract files to standard output
-G, --incremental Handle old GNU-format incremental backup
-g, --listed-incremental Handle new GNU-format incremental backup
--ignore-failed-read Do not exit with nonzero on unreadable files
Handling of file attributes:
--owner=NAME Force NAME as owner for added files
--group=NAME Force NAME as group for added files
--mode=CHANGES Force (symbolic) mode CHANGES for added
files
--atime-preserve Don't change access times on dumped files
-m, --modification-time Don't extract file modified time
--same-owner Try extracting files with the same owner-
ship
--numeric-owner Always use numbers for user/group names
-p, --same-permissions Extract all protection information
--preserve-permissions Same as -p
-s, --same-order Sort names to extract to match archive
--preserve-order Same as -s
--preserve Same as both -p and -s
Device selection and switching:
-f, --file=ARCHIVE Use archive file or device ARCHIVE
--force-local Archive file is local even if has a colon
--rsh-command=COMMAND Use remote COMMAND instead of rsh
-[0-7][lmh] Specify drive and density
-M, --multi-volume Create/list/extract multi-volume archive
-L, --tape-length=NUM Change tape after writing NUM x 1024
bytes
-F, --info-script=FILE Run script at end of each tape
(implies -M)
--new-volume-script=FILE Same as -F FILE
--volno-file=FILE Use/update the volume number in FILE
Device blocking:
-b, --blocking-factor=BLOCKS BLOCKS x 512 bytes per record
--record-size=SIZE SIZE bytes per record, multiple of 512
-i, --ignore-zeros Ignore zeroed blocks in archive
(means EOF)
-B, --read-full-records Reblock as we read (for 4.2BSD pipes)
Archive format selection:
-V, --label=NAME Create archive with volume name NAME
PATTERN At list/extract time, a globbing
PATTERN
-o, --old-archive, --portability Write a V7 format archive
--posix Write a POSIX conformant archive
-z, --gzip, --ungzip Filter the archive through gzip
-Z, --compress, --uncompress Filter the archive through compress
--use-compress-program=PROG Filter through PROG (must accept -d)
Local file selection:
-C, --dir=DIR Change to directory DIR
-T, --files-from=NAME Get names to extract or create from file NAME
--null -T reads null-terminated names, disable -C
--exclude=PATTERN Exclude files, given as a globbing PATTERN
-X, --exclude-from=FILE Exclude globbing patterns listed in FILE
-P, --absolute-names Don't strip leading '/'s from file names
-h, --dereference Dump instead the files symlinks point to
--no-recursion Avoid descending automatically in directories
-l, --one-file-system Stay in local file system when creating
archive
-K, --starting-file=NAME Begin at file NAME in the archive
-N, --newer=DATE Only store files newer than DATE
--newer-mtime Compare date and time when data changed only
--after-date=DATE Same as -N
--backup[=CONTROL] Backup before removal, choose version control
--suffix=SUFFIX Backup before removal, override usual suffix
Informative output:
--help Print this help, then exit
--version Print tar program version number, then exit
-v, --verbose Verbosely list files processed
--checkpoint Print directory names while reading the archive
--totals Print total bytes written while creating archive
-R, --block-number Show block number within archive with each message
-w, --interactive Ask for confirmation for every action
--confirmation Same as -w
The backup suffix is '~', unless set with --suffix or
SIMPLE_BACKUP_SUFFIX.
The version control may be set with --backup or VERSION_CONTROL, values
are:
t, numbered Make numbered backups
nil, existing Numbered if numbered backups exist, simple otherwise
never, simple Always make simple backups
Comments:
GNU tar cannot read nor produce '--posix' archives. If POSIXLY_CORRECT
is set in the environment, GNU extensions are disallowed with
'--posix'.
Support for POSIX is only partially implemented, don't count on it yet.
ARCHIVE may be FILE, HOST:FILE or USER@HOST:FILE; and FILE may be a
file or a device. *This* 'tar' defaults to '-f- -b20'.
GNU TAR has an extensive documentation that is beyond the scope of
this help. For more information see:
https://gitlab.com/FreeDOS/archiver/tar, folder /DOC/TAR, files
tar.info - tar.info-8.
Examples:
- none - see manual tar.info - tar.info-8
See also:
7zdec
arj
bzip2
cabext
gzip
lpq1
lzip
lzma
lzop
p7zip
slicer
unzip
zip
zoo
There is another version (3.2.1) of TAR available at:
https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/unix/tar/
Copyright © 1999 Thomas Bushnell, Francois Pinard and a lot of others,
help version 2025 W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.