Linux gzip, Gunzip

Source: Internet
Author: User

Introduction

Gzip is a compressed file command that comes with Linux, and its compression ratio is approximately 60% to 70%, which is higher than zip compression. Using gzip compression By default adds a. gz suffix to the file and deletes the source file. The gunzip is the decompression command.

Gzip

1. Do not specify a path

gzip filename
4 1 1900  - : 4 1 719: Abc.sql.gz

2. Develop the path and keep the source file, Note that the-C and output compliance cannot be omitted .

gzip-c filename >newfilename
[Email protected] backup]#gzip-c abc.sql > abc.sql.gz # # #不指定绝对路径会在当前目录下生成文件[[email protected] backup]# lltotal8-rw-r--r--.1Root root1900Sep -  -: theAbc.sql-rw-r--r--. 1 root root 719 Sep 18:33 abc.sql.gz[[email protected] backup]# gzip - c abc.sql >/ abc.sql.gz # # #指定绝对路径[[email protected] backup]# ll/ Total the-rw-r--r--.1Root root719Sep -  -: theAbc.sql.gz

3. List information about compressed files

gzip-l filename
[[Email protected] backup]# gzip-l abc.sql.gz          compressed        uncompressed  ratio uncompressed_name                 719                1900  63.9% abc.sql

The output content contains the file size, compression ratio, and file name before and after compression.

Related options:

-A or--ascii: use ASCII text mode;-C: Standard output of the extracted files, keep the source files. -D or--decompress or----uncompress: Unpack the compressed file;-F or--force: Forcibly compress the file. Ignores the existence of a file name or a hard connection and whether the file is a symbolic connection;-h or--help: online help;-L or--list: Lists information about the compressed file;-L or--license: Display version and copyright information;-N or--no-Name: When compressing a file, the original file name and time stamp are not saved;-N or--name: When compressing the file, save the original file name and time stamp;-Q or--quiet: No warning message is displayed;-R or--recursive: recursive processing, all files and subdirectories under the specified directory are processed together;-S or < compressed word tail string > or----suffix< compressed tail string >: Change the compressed word tail string;-T or--test: Test whether the compressed file is correct;-V or--verbose: Displays the instruction execution process;-V or--version: Displays version information;-< compression efficiency;: Compression efficiency is a value between 1~9 and the default value is "6", the larger the value, the higher the compression efficiency;--best: The effect of this parameter and the specified "-9"parameters are the same;--fast: The effect of this parameter and the specified "-1"parameter is the same.
Gunzip

The usage of gunzip is similar to zip.

1. Unzip the file in the current directory, this method will delete the source file

Gunzip filename
Gunzip abc.sql.gz

2. Extract to the specified directory, keep the source file,-C

Gunzip-c abc.sql.gz >abc.sql

3. View the contents of the file, you can view the contents of the compressed file when you do not specify the target file with the-c parameter.

Options:

--C or--stdout or--to--For-----nor--no---  --S or < compressed word tail string > or----suffix< compressed tail string >--V or-- Version: Displays release information;

Summary

Note:

pursuer.chen

Blog:http://www.cnblogs.com/chenmh

This site all the essays are original, welcome to reprint, but reprint must indicate the source of the article, and at the beginning of the article clearly give the link.

Welcome to the exchange of discussions

Linux gzip, Gunzip

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.