One Linux command per day (--gzip) command

Source: Internet
Author: User
Tags gz file

There are two obvious benefits of reducing file size, one is to reduce storage space, and the other is to reduce transmission time when transferring files over the network. Gzip is a frequently used Linux system command to compress and decompress files, which is both convenient and useful. 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. According to statistics, the gzip command has a 60%~70% compression rate for text files.

1. Command format:

gzip[parameters] [file or directory]

2. Command function:

Gzip is a widely used compression program, after which the file is compressed, and its name is followed by a ". gz" extension.

3. Command parameters:

-A or--ASCII use ASCII text mode.

-C or--stdout or--to-stdout the compressed file output to the standard output device, not to change the original file.

-D or--decompress or--uncompress unpack the compressed file

-F or--forece forcibly compress the file. Ignores whether the file name or hard link exists 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.

The original file name and time stamp are not saved when the file is compressed by-N or--no-name.

-N or-name compress the file, save the original file name and time stamp.

-Q or--quit does not display a warning message.

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

-s< compressed Tail string > or----suffix < compress tail string > Change compressed tail string

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

-V or--verbose show instruction execution process

-V or--version displays version information.

-num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low tumbler), 9 or--best represents the slowest compression method (high compression ratio). The system default value is 6.

4. Usage examples:

Example 1: Compress each file in the Tes6 directory into a. gz file

Command: gzip * Note: Each file is compressed into a. gz file, not tar packaged into a file and then compressed.

Example 2: Unzip each compressed file in Example 1 and list detailed information

Command:

gzip-d *

Example 3: Show details of each compressed file in Example 1, and do not understand the pressure

Command:

Gzip-l *

Example 4: Compress a tar backup file, at which time the zip file has the extension. tar.gz

Command:

Gzip-r Log.tar

Example 5: Recursive compression directory

Command:

GZIP-RV Test

In this way, all the files under test have been *.gz, the directory still exists only the files in the directory corresponding to the *.gz which is compression, and packaging is different. Because it is the directory operation,

Therefore, you need to add the-r option so that you can recursively recursive the subdirectories.

Example 6: Extracting a directory recursively

Command:

GZIP-DR Test

    

One Linux command per day (--gzip) command

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.