Linux commands gzip and gunzip unzip

Source: Internet
Author: User
Tags unpack

The gzip command is used to compress files. Gzip is a widely used compression program, after which the file is compressed, and its name is followed by a number of ". Gz" extensions.

Gzip not only compresses large, less-used files to conserve disk space, but also, together with the TAR commands, forms the most popular compressed file format in the Linux operating system.

Syntax: gzip [options] [parameters]

Basic parameters:

-A or--ascii: use ASCII text mode;

-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 compressed files;

-L or--license: Displays 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: recursively handles all files and subdirectories under the specified directory;

-S or < compress the tail string > or----suffix< compress the 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, the default value is "6", specifying the larger the value, the higher the compression efficiency;

--best: The effect of this parameter is the same as specifying the "-9" parameter;

--fast: The effect of this parameter is the same as specifying the "-1" parameter.

The gunzip command is used to extract the files. Gunzip is a widely used decompressor that unlocks files that have been compressed by gzip, which are preset with the last extension. gz.

In fact Gunzip is the hard connection of gzip, so either compression or decompression can be done separately via the gzip instruction.

Syntax: gunzip [options] [parameters]

Basic parameters:

-A or--ascii: use ASCII text mode;

-C or--stdout or--to-stdout: Output the extracted file to the standard output device;

-F or-force: Forcibly unpack the compressed file, ignoring the existence of the file name or hard connection and whether the file is a symbolic connection;

-H or--help: online help;

-L or--list: Lists information about compressed files;

-L or--license: Displays version and copyright information;

-N or--no-name: When decompressed, if the compressed file contains the original file name and time stamp, it will ignore the processing;

-N or--name: When decompressed, if the compressed file contains the original file name and time stamp, it will be stored back to the unpacked file;

-Q or--quiet: No warning message is displayed;

-R or--recursive: recursively handles all files and subdirectories under the specified directory;

-S or < compress the tail string > or----suffix< compress the 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;

Instance:

[email protected]:/tmp# lspulse-nytpvnf0u02p  sw.log  sw.log.tar.gz   swmannagement[email protected]:/tmp# gzip -9v sw.log sw.log: 93.0% --  Replaced with sw.log.gz[email protected]:/tmp# lspulse-nytpvnf0u02p  sw.log.gz   sw.log.tar.gz  swmannagement[email protected]:/tmp# gzip -l  sw.log.gz          compressed         uncompressed  ratio uncompressed_name                6465                92160  93.0% sw.log[email protected]:/tmp#  Gzip -d sw.log.gz [email protected]:/tmp# lspulse-nytpvnf0u02p  sw.log   sw.log.tar.gz  swmannagement[email protected]:/tmp# gzip -rv swmannagement/[email protected]:/tmp#  lspulse-nyTPvNf0U02p  sw.log  sw.log.tar.gz  swmannagement[email  protected]:/tmp# cd swmannagement/[email protected]:/tmp/swmannagement# lscisco2960   connect_remote_sw.py.save.gz   innerswip.gz    pingdetected.py.gz     saveip-to-database.py.gz   tmp.gz   connect_remote_ Sw.py.gz   inner_sw   iplist.gz    rebootremotehost.py.gz &NBSP;&NBSP;&NBSP;SWITCHORROUTER_LIST.GZ[EMAIL&NBSP;PROTECTED]:/TMP/SWMANNAGEMENT#&NBSP;CD&NBSP, .... [email protected]:/tmp# gzip -dr swmannagement/[email protected]:/tmp# cd  swmannagement/[email protected]:/tmp/swmannagement# lscisco2960  connect_remote_sw.py   connect_remote_sw.py.save  inner_sw  innerswip  iplist  pingdetected.py  rebootremotehost.py   saveip-to-database.py  switchorrouter_list  tmp



Linux commands gzip and gunzip unzip

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.