参考: https://www.thomas-krenn.com/en/wiki/Archive_under_Linux_(tar,_gz,_bz2,_zip)
The program tar originally stands for Tape Archiver, it was used to back up data to tape drives. It is still very popular and widespread today. A pure tar archive is not compressed.
tar xfv archive.tar
tar cfv archive.tar file1 file2 file3
tar cfzv archive.tar file1 file2 file3
tar tvf archive.tar
We refer you to the manpage of tar for more information and parameters:man tar
As we know, a tar archive is not compressed without additional options, this can be done with the additional option gzip. gzip stands for GNU zip and the file extension .gz is appended to the tar archive.
Create a compressed file:gzip file
Result: file.gz
gunzip file
tar cfvz archive.tar.gz file1 file2
tar xfvz archive.tar.gz
Besides gzip there is also bzip2, it is very similar to gzip, but uses a different algorithm.
bzip2 file
bunzip2 file.bz2
tar cfvj archive.tar.bz2 file1 file2
tar xfvj archive.tar.bz2
The tool zip is mainly used in Windows , but is also available for Linux-based operating systems.
zip archive.zip file1 file2
zip -r archive.zip folder1 folder2 folder3
unzip archive.zip
unzip -l archive.zip