Tar is a compression and packaging tool on Unix and Unix-like systems. you can combine multiple files into one file. the packaged file name is also "tar ". Currently, tar file format has become POSIX standard, initially POSIX.1-1988, is currently POSIX.1-2001. This program was initially designed to back up files to tape (tapearchive), hence the name tar. What is tar?
Overview
Tar is a compression and packaging tool on Unix and Unix-like systems. you can combine multiple files into one file. the packaged file name is also "tar ". Currently, tar file format has become POSIX standard, initially POSIX.1-1988, is currently POSIX.1-2001. The initial design of this program is to back up the file to the tape (tape archive), hence the name tar.
Version
The commonly used tar is the GNU version developed by the Free Software Foundation. The current stable version is 1.28, which was released in July 27, 2014. At the same time, there are multiple regions with different compression rates, such as tar.xzand tar.gz. The former has a higher compression ratio, but may have compatibility problems.
Abbreviations
Tar is often used together with other compression methods, such as gzip, to generate a compressed document. Tar indicates an uncompressed tar file. After a compressed tarfile is used, the extension name of the compressed file is used. for example, after the tarfile is uploaded, the extension name is ".tar.gz ". Due to the limitation of the DOS8.3 file name format, the following abbreviations are often used:
.Tgzis equivalent to .tar.gz
.Tbzand tb2are equivalent to .tar.bz2
.Tazis equivalent to .tar. Z
.Tlzis equivalent to .tar. lzma
.Txzis equivalent to .tar. xz
1. package or unpack a file
Tar-cvf all.tar *. jpg
Pack all. JPG files into a package named all.tar. -C indicates that a new package is generated,-f indicates the package file name, and-v indicates the detailed process.
Tar-rvf all.tar *. gif
Add all .gif files to the package of all.tar. -R indicates adding files.
Tar-uvf all.tar logo.gif
To update the logo.gif file in tarbao all.tar,-u indicates the meaning of the update file.
Tar-tf all.tar
List all files in the all.tar package.-t indicates listing files.
Tar-xvf all.tar
-X is used to unbind all files in the all.tar package.
2. compress or decompress the file
Tar can be packaged/unwrapped, and other compression programs can be called for compression/decompression, such as gzip and bzip2. Tarball uses gzip. gzipis a program developed by gnuorganization. the file ending with .gz is the result of gzip compression. the decompress program opposite to gzip is gunzip.
Tar-zcvf all.tar.gz *. jpg
First, compress the. jpg file into a tar package. Then, use gzipzip to generate a gzipcompressed package named all.tar.gz.
Tar-xzvf all.tar.gz
Unpack the all.tar.gz package.
Tarcall bzip2,bzip2is a more powerful compression program. the file at the end of .bz2 is the result of bzip2 compression. the decompress program opposite to bzip2 is bunzip2.
Tar-jcvf all.tar.bz2 *. jpg
Bytes
Tar-jxvf all.tar.bz2
This command unlocks the generated package.
Sankey linuxcompressed decompress. ZIP/. rar
.Zipand .rar are common compressed files in Windows. They can also be operated in linux.
Zip is a compression program, and unzip is a decompression program.
Zip all.zip *. jpg
Compress all .jpg files into a zip package
Unzip all.zip
Decompress all files in all.zip
Rar is a compression program, unrar is a decompression program.
Rar a all.rar *. jpg
Compress all. JPG files into a rarpackage named all.rar. you can also add them automatically without a suffix. However, it is recommended to write the file.
Unrar e all.rar
Decompress all files in all.rar to the current directory.
Unrar x all.rar/tmp/newrar/
Decompress all files in all.rar to the specified directory.
Unrar vb all.rar
All.rar: the content in the compressed file cannot be squashed.