gunzip

>Usage

gunzip is a command-line utility used to decompress .gz files created by the gzip command. It restores the original file by removing the .gz compression.

>Synopsis

gunzip [option] file

>Options

-c

to stdout: Decompresses the .gz file and outputs the result to the standard output (stdout) rather than creating a file.

Example 1:

Dots

-zsh

gunzip -c file.txt.gz > file.txt


the file file.gz is decompressed and redirected to the standard output without modifying the original file

-k

keep original: When you use this option, gunzip decompresses the file but keeps the original .gz file instead of deleting it after decompression.

-r

recursiv: With this option gunzip will decompress all files / subdirectories within a compressed directory recursively.

Example 2:

Dots

-zsh

gunzip -r dir/


decompress all files / subdirectories in a directory and replace each .gz file with the decompressed version

-l

list information: Used to list information about a compressed file (.gz), such as original size, compressed size,... without decompress it

Example 3:

Dots

-zsh

gunzip -l file1.gz file2.gz /


you can list the information of multiple files by separate them with a space character

-t

test: Tests the integrity of a .gz file without decompressing it. If the file is valid it will generate no output.

-S

suffix: Allows to specify a costum suffix for the compressed file instead of the default one (.gz), this will not affect the compression

Example 4:

Dots

-zsh

gunzip -S .txt file.txt.gz


the argument after -S will replace the default .gz suffix after decompression

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Oliviero Vescovo