Manual pages › General commands (1)
tar(1)
GNU tape archiver
Package: gtar, added for amigaux.
This package comes with the extra set; without it, tar runs heirloom-tar: see heirloom-tar(1); the original page is tar-original(1).
NAME · SYNOPSIS · DESCRIPTION · OPERATIONS · OPTIONS · ENVIRONMENT · AMIX NOTES · EXAMPLES · EXIT STATUS · FILES · BUGS · SEE ALSO
NAME
tar - GNU tape archiver
SYNOPSIS
tar operation [option]... [file]...
DESCRIPTION
tar saves many files together in a single archive, and restores single files or all of them from it. This is GNU tar 1.14, installed as /opt/amix/bin/tar. It does not replace the stock SVR4 tar in /usr/sbin, which stays as it is; this one is used when /opt/amix/bin comes before /usr/sbin in PATH.
Exactly one operation is given. Options may be given as long options (--file=archive.tar), as short options (-f archive.tar), or in the old style, bundled into the first argument without a dash (tar cvf archive.tar dir). An argument that is mandatory for a long option is mandatory for its short option too.
The default archive is the standard input or output (-f -), the default record size is 20 blocks of 512 bytes, and the default format for new archives is gnu.
OPERATIONS
- -c, --create
- Create a new archive from the named files and directories.
- -t, --list
- List the members of an archive.
- -x, --extract, --get
- Extract members from an archive.
- -d, --diff, --compare
- Report differences between the archive and the file system.
- -r, --append
- Append files to the end of an archive.
- -u, --update
- Append only files newer than their copy in the archive.
- -A, --catenate, --concatenate
- Append other tar archives to an archive.
- --delete
- Delete members from an archive (not on a tape).
OPTIONS
Archive and device
- -f, --file=archive
- Use archive: a file, a device, or - for standard input or output.
- -b, --blocking-factor=n
- Write records of n x 512 bytes (default 20).
- --record-size=size
- Write records of size bytes, a multiple of 512.
- -i, --ignore-zeros
- Ignore zeroed blocks in the archive, which normally mean its end.
- -B, --read-full-records
- Reblock as the archive is read (for pipes).
- -M, --multi-volume
- Create, list or extract a multi-volume archive.
- -L, --tape-length=n
- Change volumes after n x 1024 bytes.
- -F, --info-script=file, --new-volume-script=file
- Run file at the end of each volume (implies -M).
- --volno-file=file
- Keep the volume number in file.
- --force-local
- Treat an archive name with a colon as a local file.
- --rsh-command=command, --rmt-command=command
- The remote shell and the remote tape server for a host:file archive; see BUGS.
Compression
- -z, --gzip, --ungzip
- Filter the archive through gzip, found on PATH. Install the gzip package for it.
- -j, --bzip2
- Filter the archive through bzip2, found on PATH (the bzip2 package).
- -Z, --compress, --uncompress
- Filter the archive through the stock compress.
- --use-compress-program=program
- Filter the archive through program, which must accept -d.
Format
- --format=format
- Create the archive in format: v7 (the old V7 format), oldgnu (GNU tar 1.12 and older), gnu (GNU tar 1.13, the default), ustar (POSIX 1003.1-1988) or posix (POSIX 1003.1-2001, pax).
- --old-archive, --portability
- The same as --format=v7.
- --posix
- The same as --format=posix.
- --pax-option keyword[[:]=value][,...]
- Control the pax keywords of a posix archive.
- -V, --label=name
- Give a new archive the volume name name; when reading, a pattern the volume name must match.
File selection
- -C, --directory=dir
- Change to dir before the following names.
- -T, --files-from=file
- Read the names to archive or extract from file.
- --null
- The names read by -T are terminated by NUL characters.
- --exclude=pattern
- Leave out files matching pattern.
- -X, --exclude-from=file
- Leave out files matching the patterns listed in file.
- --anchored, --no-anchored, --ignore-case, --no-ignore-case, --wildcards, --no-wildcards, --wildcards-match-slash, --no-wildcards-match-slash
- How exclusion patterns match: from the start of the name (the default) or after any /; case sensitive (the default) or not; with wildcards (the default) or as plain strings; wildcards matching / (the default) or not.
- -P, --absolute-names
- Keep the leading / of file names.
- -h, --dereference
- Archive the files symbolic links point to, not the links.
- --no-recursion
- Do not descend into directories.
- -l, --one-file-system
- Stay in the file system of each named directory when creating.
- -K, --starting-file=name
- Begin at member name of the archive.
- --strip-path=n
- Strip n leading components from member names when extracting.
- -N, --newer=date, --after-date=date
- Archive only files newer than date, a date or the name of a file starting with / or . whose date is taken.
- --newer-mtime=date
- The same, comparing the modification time only.
- -G, --incremental
- Handle an old GNU-format incremental backup.
- -g, --listed-incremental=file
- Handle a new GNU-format incremental backup, keeping its state in file.
- --occurrence[=n]
- With --delete, --diff, --extract or --list and named members, act on the nth occurrence of each (default 1).
Extraction
- -k, --keep-old-files
- Do not replace existing files.
- --keep-newer-files
- Do not replace existing files that are newer than their archive copies.
- --overwrite
- Overwrite existing files.
- --no-overwrite-dir
- Keep the metadata of existing directories.
- -U, --unlink-first
- Remove each file before extracting over it.
- --recursive-unlink
- Empty a directory hierarchy before extracting a directory over it.
- -O, --to-stdout
- Extract to the standard output.
- -m, --modification-time
- Do not restore the modification time.
- -p, --same-permissions, --preserve-permissions
- Restore the permissions recorded in the archive.
- --no-same-permissions
- Do not restore the recorded permissions.
- -s, --same-order, --preserve-order
- The names to extract are in the archive's order.
- --preserve
- The same as -p and -s.
- --same-owner, --no-same-owner
- Restore the recorded owners (the default for root), or extract as yourself.
- --backup[=control], --suffix=suffix
- Back up a file before replacing it; see ENVIRONMENT.
Creation
- --owner=name, --group=name
- Record name as the owner or group of added files.
- --mode=changes
- Record the symbolic mode changes applied to added files.
- --numeric-owner
- Record and use numeric user and group ids only.
- --atime-preserve
- Keep the access times of archived files.
- -S, --sparse
- Handle sparse files efficiently.
- --remove-files
- Remove files after adding them.
- -W, --verify
- Verify the archive after writing it.
- --ignore-failed-read
- Do not exit non-zero for unreadable files.
Output
- -v, --verbose
- List the files processed; twice for a long listing.
- --totals
- Print the bytes written when creating.
- --checkpoint, --check-links, --utc
- Print directory names while reading; report hard links not all archived; print dates in UTC.
- --index-file=file
- Write the verbose output to file.
- -R, --block-number
- Show the block number in each message.
- -w, --interactive, --confirmation
- Ask before every action.
- -o
- When creating, the same as --old-archive; when extracting, the same as --no-same-owner.
- --help, --version
- Print the full option list, or the version, and exit.
ENVIRONMENT
- TAR_OPTIONS
- Options read before those on the command line.
- SIMPLE_BACKUP_SUFFIX, VERSION_CONTROL
- The backup suffix (default ~) and the kind of backup: t or numbered, nil or existing, never or simple.
- PATH
- Where gzip, bzip2 and compress are found for -z, -j and -Z.
AMIX NOTES
tar reads and writes the base-256 sizes and ids, and the long names, of modern GNU and POSIX archives.
Owner and group names are looked up by tar's own readers of /etc/passwd and /etc/group, not by the stock C library.
An archive id above the range of the SVR4 user id type is read and listed exactly, but the kernel refuses to set it: such a file is extracted owned by root, and tar exits with status 2.
Shrinking an archive in place (--delete) truncates it on a block boundary and writes the tail back, so the stock kernel's truncation fault is not reached.
EXAMPLES
- tar -cf archive.tar foo bar
- Create archive.tar from foo and bar.
- tar -tvf archive.tar
- List archive.tar verbosely.
- tar -xzf src.tar.gz -C /tmp
- Extract a gzip-compressed archive into /tmp.
EXIT STATUS
0 on success, 1 when some files differ (--diff), 2 on a fatal error.
FILES
- /opt/amix/bin/tar
- This program.
- /opt/amix/doc/tar
- Its licence, NEWS and README.
BUGS
Remote archives (host:file) have no default remote shell in this build: one must be given with --rsh-command, and the remote host must provide rmt (--rmt-command); no rmt is installed here. Remote archives are untested on Amix.
Tape ioctls are not built (the system has no <sys/mtio.h>).
--totals shows the rate as ?/s for a run under one second.
SEE ALSO
gzip(1), bzip2(1), compress(1). The full manual is GNU tar's texinfo manual; this build ships its NEWS and README in /opt/amix/doc/tar.
| 2026-10-30 | GNU tar 1.14 |