ArchWiki / Archiving and compression
ArchWiki / Archiving and compression
es:Archiving and compression hu:Archiving and compression ja:アーカイブと圧縮 pt:Archiving and compression ru:Archiving and compression zh-hans:Archiving and compression The traditional Unix archiving and compression tools are separated according to the Unix philosophy:
A file archiver combines several files into one archive file, e.g. tar.
A compression tool compresses and decompresses data, e.g. gzip.
These tools are often used in sequence by firstly creating an archive file and then compressing it.
Of course there are also tools that do both, which tend to additionally offer encryption, error detection and recovery.
Archiving only
Both GNU and BSD tar automatically do decompression delegation for bzip2, compress, gzip, lzip, lzma, lzop, zstd, and xz compressed archives. Only BSD tar supports lz4 natively (but GNU tar can do an equivalent with --use-compress-program=lz4/-Ilz4). When creating archives both support the -a switch to automatically filter the created archive through the right compression program based on the file extension. While BSD tar recognizes compression formats based on the format, GNU tar only guesses based on the file extension.
See also #Archiving only usage.
Compression tools
Compression only
These compression programs implement their own file format.
Parallel implementations offer improved speeds by using multiple CPU cores.
Tar extensions refers to compressed archives where
tarand the compression tool is used, e.g..tzois.tar.lzo.See also #Compression only usage.
Archiving and compression
See also #Archiving and compression usage.
Feature charts
Some of the tools above are capable of handling multiple formats, allowing for fewer installed packages.
Decompress
gunzip(1) can only decompress single member ZIP files.
Usage comparison
Archiving only usage
Compression only usage
Archiving and compression usage
Convenience tools
See also Bash/Functions#Extract.
Determining archive format
To extract an archive, its file format needs to be determined. If the file is properly named you can deduce its format from the file extension.
Otherwise you can use the file tool, see file(1).
Esoteric, rare or deprecated tools
File system compression
Some file systems support on-the-fly compression of file data:
Btrfs can be configured to compress individual files, directories, or entire volumes by default.
On ZFS, compression can be enabled on pools or file systems.
Device mapper compression
The open-sourced VDO project was integrated into the Linux kernel project, which provides a deduplication and compression device mapper layer in the interest of increasing storage efficiency. A userspace tools for managing VDO volumes is available in the AUR: vdo
Compression libraries
Troubleshooting
Garbled file names when extracted
See Character encoding#Troubleshooting.