Linux gzip command details how to use Linux gzip command

Source: Internet
Author: User
Tags uncompress

The pnux gzip command is used to compress files.

Gzip is a widely used compression program. After a file is compressed, its name will be followed by an extension of ". gz.

Syntax

Gzip [-acdfhlLnNqrtvV] [-S <compressed character string>] [-<compression efficiency>] [-- best/fast] [file...] or gzip [-acdfhlLnNqrtvV] [-S <compressed character string>] [-<compression efficiency>] [-- best/fast] [Directory]

Parameters:

-A or -- ascii uses the ASCII text mode.

-C or -- stdout or -- to-stdout outputs the compressed file to the standard output device, without changing the original file.

-D or -- decompress or ---- uncompress to uncompress the compressed file.

-F or -- force forcibly compresses the file. Ignore whether the file name or hard connection exists and whether the file is signed.

-H or -- help online help.

-L or -- pst lists information about compressed files.

-L or -- pcense displays version and copyright information.

-N or -- no-name: the original file name and time stamp are not saved.

-N or -- name: the original file name and time stamp are saved when the file is compressed.

-Q or -- quiet does not display warning information.

-R or -- recursive processing: All files and subdirectories under the specified directory are processed together.

-S <compression character string> or ---- suffix <compression character string> to change the compression character string.

-T or -- test to test whether the compressed file is correct.

-V or -- verbose displays the command execution process.

-V or -- version displays version information.

-<Compression efficiency>

The compression efficiency is a value between 1 and 9. The preset value is "6". The larger the value, the higher the compression efficiency.

-- Best this parameter has the same effect as the specified "-9" parameter.

-- Fast this parameter has the same effect as the specified "-1" parameter.

Instance

Compressed file

[Root@w3cschool.cc a] # ls // display the current directory file

A. c B. h d. cpp

[Root@w3cschool.cc a] # gzip * // compress all files in the directory

[Root@w3cschool.cc a] # ls // display the current directory file

A.c.gzb.h.gzd.cpp.gz

[Root@w3cschool.cc a] #

Example 1: list detailed information

[Root@w3cschool.cc a] # gzip-dv * // Unzip the file and list details

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

[Root@w3cschool.cc a] #

Example 1 shows the compressed file information.

[Root@w3cschool.cc 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.