tar (tape archive) program
The tar (tape archive) program creates archives by combining files and directories into a single file. Tarballs (archive files created by tar and usually compressed with gzip or bzip2) are often used to distribute software packages in the Linux world.
You can use many options with the tar program to modify how it functions when creating and extracting archives. Here is a list of the most common ones:
Compression tools such as gzip, bzip2, and xz are often used with tar to apply compression to the tarball as a whole rather than to the individual files. Typically, files compressed with these utilities have .gz, .bz2, or .xz extensions, respectively.
Here are some examples of the tar command.
To create a tar archive called archive.tar that contains the files results.txt and sample_text, we can use the following command:
To archive and compress files results.txt and sample.txt into a tarball file named compress.tgz, we can use the following command:
To extract the archive created above, we can use the following command: