Summary of decompression commands under Linux

.tar 

解包:tar xvf FileName.tar

Packaging: tar cvf FileName.tar DirName

(Note: tar is packaging, not compression!)

———————————————

.gz

Unzip 1: gunzip FileName.gz

Unzip 2: gzip -d FileName.gz

Compression: gzip FileName

———————————————

.tar.gz 和 .tgz

Unzip: tar zxvf FileName.tar.gz

压缩:tar zcvf FileName.tar.gz DirName

———————————————

.bz2

Unzip 1: bzip2 -d FileName.bz2

Unzip 2: bunzip2 FileName.bz2

Compression: bzip2 -z FileName

———————————————

.tar.bz2

Unzip: tar jxvf FileName.tar.bz2

压缩:tar jcvf FileName.tar.bz2 DirName

———————————————

.bz

Unzip 1: bzip2 -d FileName.bz

Unzip 2: bunzip2 FileName.bz

Compression: unknown

———————————————

.tar.bz

Unzip: tar jxvf FileName.tar.bz

Compression: unknown

———————————————

.WITH

Unzip: uncompress FileName.Z

Compression: compress FileName

.tar.Z

———————————————

Unzip: tar Zxvf FileName.tar.Z

压缩:tar Zcvf FileName.tar.Z DirName

———————————————

.zip

Unzip: unzip FileName.zip

Compression: zip FileName.zip DirName

———————————————

.rar

Unzip: rar x FileName.rar

压缩:rar a FileName.rar DirName

———————————————

.lha

Unzip: lha -e FileName.lha

压缩:lha -a FileName.lha FileName

———————————————

 

The gzip command is a command that is often used in Linux systems to compress and decompress files, which is convenient and easy to use.

Syntax: gzip [options] Compressed (decompressed) filenames The meanings of the options of this command are as follows:

-c Write output to standard output and keep the original file.

-d Decompress the compressed file.

-l For each compressed file, display the following fields: compressed file size; uncompressed file size; compression ratio; uncompressed file name

-r Recursively find the specified directory and compress or decompress all files in it.

-t Test to check if the compressed file is complete.

-v For each compressed and decompressed file, display the file name and compression ratio.

-num Adjust the speed of compression with the specified number num, -1 or --fast means the fastest compression method (low compression ratio), -9 or --best means the slowest compression method (high compression ratio). The system default value is 6.

Command example:

gzip *% compresses each file in the current directory into a .gz file.

gzip -dv *% Extract each compressed file in the current directory and list detailed information.

gzip -l *% Displays detailed information about each compressed file in Example 1, but does not decompress it.

gzip usr.tar% Compresses the tar backup file usr.tar, and the extension of the compressed file is .tar.gz.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326264514&siteId=291194637