path"."> What should I do if .gz cannot be decompressed in Linux?-Linux Operation and Maintenance-php.cn

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

WBOY
Release: 2022-05-31 17:22:38
Original
6004 people have browsed it

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
Copy after login

The example is as follows:

Extract the file to the specified folder:

tar xzvf fenci.py.tar.gz -C pythontab/
Copy after login

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
Copy after login

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
Copy after login

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

zcat pythontab.gz > /home/test/aa/pythontab.py
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!