path"."/> path".">
Home > Article > Operation and Maintenance > What should I do if .gz cannot be decompressed in Linux?
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".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
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/
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!