tar
tar, or Tape ARchive, is a archiving format and utility first developed for Version 7 Unix in 1977. Itโs original purpose was to collate files into one that can be stored on tape. Similarly, today it is used to bring many files together into a โtarballโ, which can be compressed with any general data compression algorithm.
Usage
Create a tar archive
tar -cf {archive name} {files listed here}You can use tar to compress your archive, for example into a .tar.gz or .tar.xz archive. To do this, you either can either use a flag such as -z, -j, or -J (gzip, bzip2, xz), or you can use -a (โautomaticโ), which allows it to intuit what algorithm you want from the file extension, such as archive.tar.xz for an xz compressed tarball.
GNU tar can use these compression algorithms
- gzip (.gz)
- bzip2 (.bz)
- xz (.xz)
- lzip (.lz)
- lzma (.lzma)
- lzop (.lzo)
- zstd (.zstd)
Extract a tar archive
tar -xf {tarball}.tar -C {directory to extract to}tar can extract from itโs supported compressed formats, such as archive.tar.xz automatically, with no extra flags.