commands

gzip — compress a stream

GNU gzip compresses a stream. -c preserves input and writes stdout; -d decodes; -t tests integrity. Default file compression may replace the input. Example assumes a fresh archive lab fixture with new output names.

Formal Syntax & Structure

linux syntaxlinux
gzip [-c|-d|-t] [FILE...]

Parameters & Attributes

NameTypeDescription
-coptionstdout
-doptiondecode
-toptiontest
FILEoperandinput file

Return Value

exit status and output

GNU gzip compresses a stream. -c preserves input and writes stdout; -d decodes; -t tests integrity. Default file compression may replace the input.

Working Example

Example Snippetlinux
gzip -c notes.txt > notes.gzgzip -t notes.gz && gzip -dc notes.gz
Linux Reference