translations: [ fr/Français ] · [ es/Español ] · [ de/Deutsch ]
Table of contents
Gzip is a powerful compression tool in Linux, widely used for reducing file sizes without compromising data integrity. This comprehensive guide covers various aspects of Gzip, enabling efficient file and folder compression.
Individual File Compression
Compressing individual files using Gzip is straightforward:
gzip [file_name]
Bulk File Compression
To compress multiple files simultaneously, use wildcards or specific file extensions:
gzip *.txt
gzip file1 file2
Compressing Folders
Compressing entire folders is simple; use the -r flag for recursive compression:
gzip -r folder_name
Checking Default Compression Level
To determine the default compression level used by Gzip, use the following commands:
gzip -l [file_name]
file [file_name]
For instance:
gzip -l index.html.gz
compressed uncompressed ratio uncompressed_name
4350 11129 61.2% index.html
Running file index.html.gz
returns information about the file, showcasing details like the compression method, original size, and modification timestamp:
file index.html.gz
index.html.gz: gzip compressed data, was "index.html", last modified: Wed Jan 3 12:44:39 2024, max compression, from Unix, original size modulo 2^32 11129
This method provides insight into the compression level, indicated by “max compression” in the file
output.
Piping Data to Gzip
Gzip supports on-the-fly compression using data piping. For instance, compressing output from other commands:
mysqldump [database_name] | gzip > backup.sql.gz
By understanding these nuances and functionalities of Gzip, you can efficiently compress files and folders while harnessing its full potential in various scenarios.
Created on: Jan 3, 2024
Discover More within this Subject:
- Mastering Linux Terminal Navigation: Essential Shortcuts for Efficiency
- Flatpak Software Removal and Cleanup
- Installing Software With Flatpak
- Most Used and Useful Linux Commands
- Converting Audio Files Using Sox