The pnux gzip command is used to compress files.
Gzip is a widely used compression program. After a file is compressed, its name will be followed by an extension of ". gz.
Syntax
Gzip [-acdfhlLnNqrtvV] [-S <compressed character string>] [-<compression efficiency>] [-- best/fast] [file...] or gzip [-acdfhlLnNqrtvV] [-S <compressed character string>] [-<compression efficiency>] [-- best/fast] [Directory]
Parameters:
-A or -- ascii uses the ASCII text mode.
-C or -- stdout or -- to-stdout outputs the compressed file to the standard output device, without changing the original file.
-D or -- decompress or ---- uncompress to uncompress the compressed file.
-F or -- force forcibly compresses the file. Ignore whether the file name or hard connection exists and whether the file is signed.
-H or -- help online help.
-L or -- pst lists information about compressed files.
-L or -- pcense displays version and copyright information.
-N or -- no-name: the original file name and time stamp are not saved.
-N or -- name: the original file name and time stamp are saved when the file is compressed.
-Q or -- quiet does not display warning information.
-R or -- recursive processing: All files and subdirectories under the specified directory are processed together.
-S <compression character string> or ---- suffix <compression character string> to change the compression character string.
-T or -- test to test whether the compressed file is correct.
-V or -- verbose displays the command execution process.
-V or -- version displays version information.
-<Compression efficiency>
The compression efficiency is a value between 1 and 9. The preset value is "6". The larger the value, the higher the compression efficiency.
-- Best this parameter has the same effect as the specified "-9" parameter.
-- Fast this parameter has the same effect as the specified "-1" parameter.
Instance
Compressed file
[Root@w3cschool.cc a] # ls // display the current directory file
A. c B. h d. cpp
[Root@w3cschool.cc a] # gzip * // compress all files in the directory
[Root@w3cschool.cc a] # ls // display the current directory file
A.c.gzb.h.gzd.cpp.gz
[Root@w3cschool.cc a] #
Example 1: list detailed information
[Root@w3cschool.cc a] # gzip-dv * // Unzip the file and list details
A.c.gz: 0.0% -- replaced with a. c
B .h.gz: 0.0% -- replaced with B .H
D.cpp.gz: 0.0% -- replaced with d. cpp
[Root@w3cschool.cc a] #
Example 1 shows the compressed file information.
[Root@w3cschool.cc a] # gzip-l *
Compressed uncompressed ratio uncompressed_name
24 0 0.0% a. c
24 0 0.0% B. h
26, 0, 0.0%, d. cpp