Linux Command - gzip

gzip - Compress/uncompress files with gzip compression. Compression reduces disk usage and transfer time. gzip is commonly used. the file created by gzip has ‘.gz’ extension.

Syntax

1
gzip [OPTION] FILE

Options

Option Description
-c –stdout write output to standard out, keeps original files unchanged
-d decompress
-v verbose mode

Example

Compress a file and replace original

1
gzip file1

This will create a compress file and replace the original file

Uncompress a file and replace original

1
gzip -d file1.gz

replace file1.gz with the uncompress file

Compress a file but keep original

1
gzip -cv file1 > output.gz

Reference