web123456

Linux decompression command

tar

-c: Create a compressed file
-x: Decompression
-t: View content
-r: Append files to the end of the compressed archive file
-u: Update the files in the original compressed package

These five are independent commands, and one of them must be used for compression and decompression. You can use them in conjunction with other commands, but you can only use one of them.The following parameters are optional when compressing or decompressing the archive as needed.

-z: with gzip attribute
-j: with bz2 attribute
-Z: with compress attribute
-v: Show all processes

-O: Unlock the file to standard output

The following parameter -f is required

-f: Use file name, remember, this parameter is the last parameter, and only the file name can be followed.

# tar -cf *.jpg
This command is to type all .jpg files into a package called. -c means to generate a new package, and -f specifies the file name of the package.

# tar -rf *.gif
This command adds all .gif files to the package. -r means adding files.

# tar -uf
This command updates the original tar package file, and -u means to update the file.

# tar -tf
This command lists all files in the package, and -t means listing files

# tar -xf
This command is to unpack all files in the package, and -x means to unpack

compression

tar –cvf *.jpg //Package all jpg files in the directory into

tar –czf *.jpg   //After packing all jpg files in the directory, and compressing them with gzip to generate a gzip compressed package named

tar –cjf .bz2 *.jpg //After packing all jpg files in the directory, and compressing them with bzip2 to generate a bzip2 compressed package named .bz2

tar –cZf *.jpg   //After packing all jpg files in the directory, and compressing them with compress to generate an umcompress compressed package named

rar a *.jpg //Rar format compression, you need to download rar for linux first

zip *.jpg //zip format compression, you need to download zip for linux first

Decompression

tar –xvf //Decompress the tar package

tar -xzvf //Decompression

tar -xjvf.bz2   //Decompress tar.bz2

tar –xZvf    //Decompression

unrar e //Decompress rar

unzip //Decompress zip

Summarize

1. *.tar is used to decompress with tar –xvf

2. *.gz uses gzip -d or gunzip to decompress

3. *. and *.tgz are used to decompress with tar –xzf

4. *.bz2 uses bzip2 -d or bunzip2 to decompress

5. *.tar.bz2 is used to decompress with tar –xjf

6. *.Z uses uncompress to decompress

7. *. Use tar –xZf to decompress

8. *.rar is used to decompress with unrar e

9. *.zip is used to unzip