Home > Article > Operation and Maintenance > What is the gz decompression command in linux?
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".
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 command gzip 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:
2. Decompression
Syntax
gzip -d 压缩文件 gunzip 压缩文件
For example, to decompress a11.txt.gz and a1.txt.gz in the above figure, use the command gzip -d a11.txt respectively. .gz
and gunzip a1.txt.gz
The effect is as follows:
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!