The gzip command is used to compress files. Gzip is a widely used compression program, after which the file is compressed, and its name is followed by a number of ". Gz" extensions.
Gzip not only compresses large, less-used files to conserve disk space, but also, together with the TAR commands, forms the most popular compressed file format in the Linux operating system.
Syntax: gzip [options] [parameters]
Basic parameters:
-A or--ascii: use ASCII text mode;
-D or--decompress or----uncompress: unpack the compressed file;
-F or--force: Forcibly compress the file. Ignores the existence of a file name or a hard connection and whether the file is a symbolic connection;
-H or--help: online help;
-L or--list: Lists information about compressed files;
-L or--license: Displays version and copyright information;
-N or--no-name: When compressing a file, the original file name and time stamp are not saved;
-N or--name: When compressing the file, save the original file name and time stamp;
-Q or--quiet: No warning message is displayed;
-R or--recursive: recursively handles all files and subdirectories under the specified directory;
-S or < compress the tail string > or----suffix< compress the tail string;: Change the compressed word tail string;
-T or--test: Test whether the compressed file is correct;
-V or--verbose: Displays the instruction execution process;
-V or--version: Displays version information;
-< compression efficiency;: Compression efficiency is a value between 1~9, the default value is "6", specifying the larger the value, the higher the compression efficiency;
--best: The effect of this parameter is the same as specifying the "-9" parameter;
--fast: The effect of this parameter is the same as specifying the "-1" parameter.
The gunzip command is used to extract the files. Gunzip is a widely used decompressor that unlocks files that have been compressed by gzip, which are preset with the last extension. gz.
In fact Gunzip is the hard connection of gzip, so either compression or decompression can be done separately via the gzip instruction.
Syntax: gunzip [options] [parameters]
Basic parameters:
-A or--ascii: use ASCII text mode;
-C or--stdout or--to-stdout: Output the extracted file to the standard output device;
-F or-force: Forcibly unpack the compressed file, ignoring the existence of the file name or hard connection and whether the file is a symbolic connection;
-H or--help: online help;
-L or--list: Lists information about compressed files;
-L or--license: Displays version and copyright information;
-N or--no-name: When decompressed, if the compressed file contains the original file name and time stamp, it will ignore the processing;
-N or--name: When decompressed, if the compressed file contains the original file name and time stamp, it will be stored back to the unpacked file;
-Q or--quiet: No warning message is displayed;
-R or--recursive: recursively handles all files and subdirectories under the specified directory;
-S or < compress the tail string > or----suffix< compress the tail string;: Change the compressed word tail string;
-T or--test: Test whether the compressed file is correct;
-V or--verbose: Displays the instruction execution process;
-V or--version: Displays version information;
Instance:
[email protected]:/tmp# lspulse-nytpvnf0u02p sw.log sw.log.tar.gz swmannagement[email protected]:/tmp# gzip -9v sw.log sw.log: 93.0% -- Replaced with sw.log.gz[email protected]:/tmp# lspulse-nytpvnf0u02p sw.log.gz sw.log.tar.gz swmannagement[email protected]:/tmp# gzip -l sw.log.gz compressed uncompressed ratio uncompressed_name 6465 92160 93.0% sw.log[email protected]:/tmp# Gzip -d sw.log.gz [email protected]:/tmp# lspulse-nytpvnf0u02p sw.log sw.log.tar.gz swmannagement[email protected]:/tmp# gzip -rv swmannagement/[email protected]:/tmp# lspulse-nyTPvNf0U02p sw.log sw.log.tar.gz swmannagement[email protected]:/tmp# cd swmannagement/[email protected]:/tmp/swmannagement# lscisco2960 connect_remote_sw.py.save.gz innerswip.gz pingdetected.py.gz saveip-to-database.py.gz tmp.gz connect_remote_ Sw.py.gz inner_sw iplist.gz rebootremotehost.py.gz &NBSP;&NBSP;&NBSP;SWITCHORROUTER_LIST.GZ[EMAIL&NBSP;PROTECTED]:/TMP/SWMANNAGEMENT#&NBSP;CD&NBSP, .... [email protected]:/tmp# gzip -dr swmannagement/[email protected]:/tmp# cd swmannagement/[email protected]:/tmp/swmannagement# lscisco2960 connect_remote_sw.py connect_remote_sw.py.save inner_sw innerswip iplist pingdetected.py rebootremotehost.py saveip-to-database.py switchorrouter_list tmp
Linux commands gzip and gunzip unzip