Easy Tutorial
❮ Linux Comm Resize Linux Comm Uupick ❯

Linux gzip Command

Linux Command Manual

The Linux gzip command is used to compress files.

gzip is a widely used compression program that, when used on files, appends a ".gz" extension to the filename.

Syntax

gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][文件...] or gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][目录]

Parameters:

Examples

Compress files:

[[email protected] a]# ls // Display current directory files
a.c b.h d.cpp
[[email protected] a]# gzip * // Compress all files in the directory
[[email protected] a]# ls // Display current directory files
a.c.gz    b.h.gz    d.cpp.gz
[[email protected] a]#

Continuing from Example 1, list detailed information:

[[email protected] a]# gzip -dv * // Decompress files and list detailed information
a.c.gz:     0.0% -- replaced with a.c
b.h.gz:     0.0% -- replaced with b.h
d.cpp.gz:     0.0% -- replaced with d.cpp
[[email protected] a]#

Continuing from Example 1, display information about compressed files:

[[email protected] a]# gzip -l *
     compressed    uncompressed ratio uncompressed_name
         24          0  0.0% a.c
         24          0  0.0% b.h
         26          0  0.0% d.cpp

Linux Command Manual

❮ Linux Comm Resize Linux Comm Uupick ❯