Exploring gzip and gunzip - Linux Commands

| 4 min read

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
OptionDescription
-dDecompress the file (same as using gunzip)
-cWrite output to standard output (stdout) and keep the original files unchanged
-kKeep the original files after compression
-vDisplay the name and percentage reduction for each file
  • Options for gunzip
OptionDescription
-cWrite output to standard output (stdout) and keep the original files unchanged
-fForce decompression, even if the file appears to be corrupted
-lList the contents of the compressed file
-tTest 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!