Home>Article>Operation and Maintenance> What is the gz decompression command in linux?

What is the gz decompression command in linux?

coldplay.xixi
coldplay.xixi Original
2021-03-17 14:34:31 85298browse

The gz decompression command of Linux is gzip. The gzip command can compress files as well as decompress files. If you want to compress a file, execute "gzip source file"; for example, to compress a "b.txt" file, execute the command "gzip b.txt". If you want to decompress the file, just execute "gzip -d compressed file" or "gunzip compressed file".

What is the gz decompression command in linux?

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

Linux gz decompression command:

1. Compression

Compressed file

Syntax

gzip 源文件

If you want to compress b.txt, use the commandgzip b.txt

Note: The source file will disappear when compressed into a .gz file

If you want To retain the source file, use the command

gzip -c 源文件 > 压缩文件

such as compress b.txt and retain b.txt. Use the command

gzip -c b.txt > b.txt.gz

to compress the directory

Syntax

gzip -r 目录

Note: gzip Compressing a directory will only compress all the files in the directory but not the directory

As shown below

Write the picture description here:

What is the gz decompression command in linux?

2. Decompression

Syntax

gzip -d 压缩文件 gunzip 压缩文件

For example, to decompress a11.txt.gz and a1.txt.gz in the above figure, use the commandgzip -d a11.txt respectively. .gzandgunzip a1.txt.gz

The effect is as follows:

What is the gz decompression command in linux?

Related learning recommendations:linux video tutorial

The above is the detailed content of What is the gz decompression command 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