1. Commonly used compression formats under Linux

1. Commonly used compression formats under Linux

Commonly used compression extensions under Linux are: .tar, .tar.bz2, .tar.gz.

2. Installation of 7ZIP software under Windows

​ Because many files under Linux are compressed files ending in .bz2 and .gz, you need to install 7ZIP software under Windows.

3. gzip compression tool

The .gzip tool is responsible for compressing and decompressing compressed packages in .gz format.

gzip xxx			//压缩
gzip -d xxx.gz	//解压缩

gzip//对文件夹进行压缩

gzip -r xxx		//对文件夹进行压缩

gzip -rd xxx.gz	//对文件夹进行解压缩

Although gzip can compress folders, it does not provide packaging services. It only compresses all files in the folder individually.

4. bzip2 compression tool

Similar to gzip, except that the bzip2 tool is responsible for compressing and decompressing compressed packages in .bz2 format.

bzip2 -z xxx			//压缩

bzip2 -d xxx.gz	//解压缩

5. tar packaging tool

​ tar tool parameters:

-f, use archive file or ARCHIVE device

-c: Create a new archive, create a compressed file

-x: Extract the file from the image file and decompress it

-j: Use bzip2 compression format.

-z: Use gzip compression format

-v: Print out the command execution process.

The tar tool provides packaging services, which is to package multiple files, such as

tar -vcf test.tar test //Package test into test.tar

tar -vxf test.tar //Unpack

​ The above tar command only provides packaging and unpacking functions. tar not only provides packaging and unpacking, but also uses gzip/bzip2 for compression, implementing commands similar to the winRAR software under Windows.

*1. Compress and decompress .* *tar.bz2* *

​ tar -vxjf xxx.tar.bz2 decompression

​ tar -vcjf xxx.tar.bz2 xxx compression

2. Compress and decompress .tar.gz

​ tar -vxzf xxx.tar.gz //Decompress

​ tar -vczf xxx.tar.gz xxx //Compression

6. Compression and decompression of other formats

1. .rar format

​ Need to install rar first: sudo apt-get install rar

​ rar x xxx.rar //Decompress

​ rar a xxx.rar xxx //Compression

2.zip format

​Zip format compression uses the "zip" command:

​ zip -rv xxx.zip xxx

​Use the "unzip" command to decompress the zip format:

​ unzip -v xxx.zip

Guess you like

Origin blog.csdn.net/qq_45865950/article/details/132751980