path"."/> path".">

Home  >  Article  >  Operation and Maintenance  >  What should I do if .gz cannot be decompressed in Linux?

What should I do if .gz cannot be decompressed in Linux?

WBOY
WBOYOriginal
2022-05-31 17:22:386128browse

Method: 1. Use the tar command to decompress the ".tar.gz" file, the syntax is "tar xzvf .tar.gz file - C decompression path"; 2. Use the gzip or zcat command to decompress ".gz" file, the syntax is "gzip -b .gz file" or "zcat .gz file> path".

What should I do if .gz cannot be decompressed in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What to do if .gz cannot be decompressed in Linux

1. .tar.gz file

This kind of file is a compressed file of tar file. Use tar command to decompress.

Extract:

tar zxvf pythontab.tar.gz

The example is as follows:

Extract the file to the specified folder:

 tar  xzvf  fenci.py.tar.gz  -C  pythontab/

What should I do if .gz cannot be decompressed in Linux?

2. Simple decompression of .gz files

This kind of file cannot be decompressed using the tar command. It needs to be decompressed using gunzip. Use the command gzip

to decompress:

gzip -b pythontab.gz

But note: It seems that gzip cannot be set to decompress to a specified directory, but can only decompress to the current directory.

Method 2:

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

Recommended learning: Linux video tutorial

The above is the detailed content of What should I do if .gz cannot be decompressed in Linux?. For more information, please follow other related articles on the PHP Chinese website!

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