gunzip

Used to decompress files

Supplementary instructions

gunzip command is used to decompress files. Gunzip is a widely used decompression program. It is used to decompress files compressed by gzip. These compressed files have a final extension of .gz by default. In fact, gunzip is a hard connection to gzip, so whether it is compression or decompression, it can be completed independently through the gzip command.

grammar

gunzip(options)(parameters)

Options

-a or --ascii: use ASCII text mode;
-c or --stdout or --to-stdout: Output the decompressed file to the standard output device;
-f or -force: Forcefully decompress the compressed file, regardless of whether the file name or hard link exists and whether the file is a symbolic link;
-h or --help: online help;
-l or --list: List related information of compressed files;
-L or --license: displays version and copyright information;
-n or --no-name: When decompressing, if the compressed file contains the original file name and timestamp, it will be ignored and not processed;
-N or --name: When decompressing, if the compressed file contains the original file name and timestamp, it will be saved back to the decompressed file;
-q or --quiet: do not display warning messages;
-r or --recursive: recursive processing, processing all files and subdirectories in the specified directory together;
-S or <compressed suffix string> or ----suffix <compressed suffix string>: change the compressed suffix string;
-t or --test: Test whether the compressed file is correct;
-v or --verbose: displays the instruction execution process;
-V or --version: display version information;

Parameters

File list: Specify the compressed package to be decompressed.

Example

First, compress all files and subdirectories in the /etc directory, back up the compressed package etc.zip to the /opt directory, then perform gzip compression on the etc.zip file, and set the gzip compression level to 9.

zip –r /opt/etc.zip /etc
gzip -9v /opt/etc.zip

View the compression information of the above etc.zip.gz file.

gzip -l /opt/etc.zip.gz
compressed uncompressed ratio uncompressed_name
11938745 12767265 6.5% /opt/etc.zip

Unzip the above etc.zip.gz file to the current directory.

[root@mylinux ~]#gzip –d /opt/etc.zip.gz
or execute
[root@mylinux ~]#gunzip /opt/etc.zip.gz

From the above example, you can know that gzip –d is equivalent to the gunzip command.