Dump the code
Best ressources to improve your Python Skills

Linux : compression and decompression

Created 10 months ago
Posted By admin
2min read
"gzip" is a file compression and decompression tool used in Unix or linux. It is often used to compress single files or to combine with other tools to compress multiple files and directories. Here are some basic commands and concepts related to "gzip":

Compression:
To compress a file using "gzip", you can use the following command:

gzip filename

This command will create a compressed file with a ".gz" extension, and the original file will be replaced with the compressed version.

Decompression:
To decompress a file that has been compressed with "gzip`", you can use the following command:

gzip -d filename.gz

Alternatively, you can use the 'gunzip' command, which is equivalent to 'gzip -d':

gunzip filename.gz

Keep Original File:
By default, 'gzip' removes the original file after compressing it. If you want to keep the original file, you can use the '-k' or '--keep' option:

gzip -k filename

Compression Level:
You can specify the compression level when compressing a file. The default compression level is usually 6. The compression levels range from 1 (fastest, less compression) to 9 (slowest, best compression). For example:

gzip -9 filename

Viewing Compression Ratio:
To view the compression ratio after compressing a file, you can use the '-l' or '--list' option:

gzip -l filename.gz

This will display information about the compressed file, including its original and compressed sizes.

These are some of the basic commands and options for using 'gzip'. Keep in mind that 'gzip' is often used in combination with other commands, such as 'tar' for compressing entire directories.
Topics

Mastering Nginx

27 articles

Bash script

2 articles

Crontab

2 articles