What are the gzip and gunzip Commands in Linux?
The gzip
and gunzip
commands are used for compressing and decompressing files, respectively. gzip
is commonly used to reduce the size of files for storage or transfer, while gunzip
is used to extract files compressed by gzip
.
Basic Syntax:
- gzip:
gzip [option] [file]
- gunzip:
gunzip [option] [file]
Options
- Options for
gzip
Option | Description |
---|---|
-d | Decompress the file (same as using gunzip ) |
-c | Write output to standard output (stdout) and keep the original files unchanged |
-k | Keep the original files after compression |
-v | Display the name and percentage reduction for each file |
- Options for
gunzip
Option | Description |
---|---|
-c | Write output to standard output (stdout) and keep the original files unchanged |
-f | Force decompression, even if the file appears to be corrupted |
-l | List the contents of the compressed file |
-t | Test the integrity of the compressed file |
Additional Help
You can explore more by using the commands:
# gzip
gzip --help
# or
man gzip
# gunzip
gunzip --help
# or
man gunzip
Thank you!
Thank you for your time and for reading this!