GNU tar is an archiver tool that provides the ability to create tar archives, as well as various other kinds of manipulation. The three most used functions are storage, backup and transportation. Five more advanced operations are: --append, --update, --concatenate, --delete and --compare. In addition, tar supports many kinds of compression, among others: gzip, bzip2, lzip, lzma, lzop, xz, and gz.
- 1 Installation
- 2 Removal
- 3 Usage
- 4 Additional information
- 5 See also
- 6 External resources
USE flags for app-arch/tar Use this to make tarballs :)
||Add support for Access Control Lists|
||just install `tar`|
||Add Native Language Support (using gettext - GNU locale utilities)|
||!!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur|
||Add support for extended attributes (filesystem-stored metadata)|
After adjusting USE flags:
emerge --ask app-arch/tar
emerge --ask --depclean app-arch/tar
displays by default the short tar option summary. This summary is organized by groups. The exact visual representation of the help output is configurable via ARGP_HELP_FMT environment variable. For more information please refer to GNU's tar manual
Usage: tar [OPTION...] [FILE]... ...
Most of the tar operations and options can be written in any of three forms: long, short and old style.
The "old style" option forms exist in GNU tar for compatibility with Unix tar.
Three most frequently used options
Some useful options are:
-xz: for tar.gz or .tgz.
-xy: for tar.bz2 or .tbz2.
-xJ: for tar.xz or .txz.
The fastest way to extract a tarball is
tar -xf tarball, because it can recognize any additional extension
- To specify the name of an archive:
tar -f archive-name
- For showing the files being worked on as tar is running:
For additional information refer to Official documentation
In order to create a compressed tar file, also known as 'tarball', there are many ways, but the best one may be:
This option will select the compression program based on the suffix of the archive file name. For example:
tar caf archive.tar.bz2
This command will produce a bz2 tarball, while:
tar -caf archive.tar.lzma
will produce a lzma tarball.
As we mentioned before, the "old" style is maintained for compatibility reasons, and so
-cafstill work the same way.
Because of the wide number of tar's options is not possible to cover all the advanced features of this program on a single wiki entry. Some of the more advanced features include.
- Add files to existing archives
- Updating an archive
- Options used by
- Performing backups and restoring files
- Excluding some files
- Crossing file system boundaries
This information and more is available in the GNU tar manual
- Zip — provides classic zip compression.
- P7zip — a command-line port of 7-Zip for POSIX compliant systems such as Unix, OS X, BeOS, and Amiga.
- Unzip — provides decompression for classic zip formats.
- GNU tar: an archiver tool (official).