gzip Linux Commands

What is Linux gzip Command?

Explanation

gzip COMMAND:

gzip is a command used to compress or decompress the files or a folder with the extension .gz.

SYNTAX :


gzip [options] filename

OPTIONS:


-a Ascii text mode: convert end-of-lines using local conventions.
-c Write output on standard output; keep original files unchanged.
-d --decompress --uncompress Decompress.
-f Force compression or decompression even if the file has multiple links or the corresponding file already exists
-l --list It list the compressed size: size of the compressed file,,uncompressed size: size of the uncompressed file ,ratio: compression ratio (0.0% if unknown) ,uncompressed_name: name of the uncompressed file
-L Display the gzip license and quit.
-q --quiet Suppress all warnings.
-n --no-name When compressing, do not save the original file name and time stamp by default.
-N --name When compressing, always save the original file name and time stamp; this is the default.
-r --recursive Travel the directory structure recursively.
-S .suf --suffix .suf Use suffix .suf instead of .gz. Any suffix can be given, but suffixes other than .z and .gz should be avoided to avoid confusion when files are transferred to other systems.
-t --test Test. Check the compressed file integrity.
-# --fast --best Regulate the speed of compression using the specified digit #, where -1 or --fast indicates the fastest compression method and -9 or --best indicates the slowest compression method.

EXAMPLE:


  1. Compress
    gzip test.txt
    Output:
    The command would compress the test.txt file as test.txt.gz in the current directory.
  2. Decompress
    gunzip test.txt.gz
    Output:
    The command will extract the file test.txt from test.txt.gz.

Ask Questions

Ask Question