All rights reserved, please indicate the source when citing
Compressing and Decompressing gz Files with Gzip
The gzip command (GNU zip) is specifically designed for compressing and decompressing "gz" files, typically identified by the ".gz" file extension. The syntax for the gzip command is gzip [OPTIONS] FILES.
Here are some commonly used options:
-c: Write the compressed output to standard output.
-d: Decompress a file.
-k: Keep the original file.
-v: Display compression ratio and other information.
$ gzip * ←Compress all files in the current working directory
$ gzip -d *.gz ←Decompress all ".gz" files in the current working directory
$ gzip -9 *.cpp ←Compress all ".cpp" files with compression level 9
For more examples, explanations, please refer to the provided link.