Home  >  Article  >  php教程  >  Detailed explanation of decompression of .tar.gz and .gz files under Linux

Detailed explanation of decompression of .tar.gz and .gz files under Linux

高洛峰
高洛峰Original
2016-11-23 11:36:342414browse

.tar.gz and .gz files are two different files and need to be treated differently. Of course, the decompression commands are also different. Let’s share their respective decompression methods.

1. .tar.gz file, this file is a compressed file of a tar file and can be decompressed using the tar command.

For example:

Extract: tar zxvf pythontab.tar.gz

Extract the file to the specified folder: tar xzvf fenci.py.tar.gz -C pythontab/

2. Simple. gz file decompression. This kind of file cannot be decompressed using the tar command. It needs to be decompressed with gunzip. Use the command gzip

to decompress: gzip -b pythontab.gz

But note: gzip does not seem to be able to be set to decompress to a specified directory. , can only be decompressed to the current directory.

Method 2 to decompress a simple .gz file:

Use the zcat command, and then save the standard output to a file.

For example:

zcat pythontab.gz > pythontab.py

Of course, this solves the need to unzip to the specified directory.

zcat pythontab.gz > /home/test/aa/pythontab.py

The above is the decompression of .tar.gz and .gz files under Linux



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn