The gzip command is a well known and simplest way to compress and decompress files within Linux system. When you using “gzip” command to compress files, the files get smaller than its actual size. The “gzip” command works based on the compression method called Lempel-Ziv and it is one of the advanced compression technique.
When you compress a folder, its name will remain the same with .gz extension. In some special scenarios when the folder name is too long the compressed folder name will be truncated.
Compress folders/files using gzip command:
Use the below simplest command to compress a file name in Linux system,
For example, consider the file name is demofile.odt use the below command to compress it
Decompress folders/files using gzip command:
Use the below simplest command to decompress a file name in Linux system,
gzip -d filename.gz
For instance, To decompress demofile.odt.gz
gzip -d demofile.odt.gz