1. Command Introduction The gzip (GNU zip) command is used to compress and decompress files. It is a command often used in Linux systems to compress and decompress files. It uses the LZ77 lossless compression algorithm. The compressed files generally use the .gz suffix. gzip can not only be used to compress large, seldom used files to save disk space, but can also be used together with the tar command to form a popular compressed file format in the Linux operating system. According to statistics, the gzip command has a compression rate of 60% to 70% for text files. Reducing file size has two obvious benefits. One is that it can reduce storage space. The other is that when transferring files over the network, it can reduce the transmission time. 2. Command format gzip [ -acdfhlLnNrtvV19 ] [-S SUFFIX ] [ NAME... ] 3. Option Description -a --ascii Use ASCII text mode. Use local conventions when converting end-of-line characters. This option is supported only on some non-Unix systems. For MSDOS, convert CR LF to LF when compressing, and convert LF to CR LF when decompressing -c, --stdout, --to-stdout Output the compressed file to standard output without changing the original file -d, --decompress, --uncompress unzip -f, --force Force compression or decompression, even if the file has multiple links or the corresponding file already exists, or the compressed data is read from or written to the terminal -h, --help Display help information and exit -l, --list List relevant information of compressed files -L, --license Display copyright information and exit -n, --no-name When compressing files, the original file names and timestamps are not saved. When decompressing, the original file name and timestamp will not be restored even if they exist. This option is the default option when decompressing -N, --name When compressing, always save the original filename and timestamp; this is the default. When decompressing, the original filename and timestamp are restored if they exist. This option is useful on systems that limit file name lengths or where timestamps are lost after file transfers. -q, --quiet Do not display warning messages -r, --recursive Recursive processing, process all files and subdirectories under the specified directory together -S, --suffix=SUFFIX Change the suffix of the compressed and decompressed files -t, --test Test whether the compressed file is correct -v, --verbose Display the command execution process -V, --version Show version information and exit -#, --best, --fast Specifies the compression effect. The compression ratio is a value between 1 and 9. The larger the value, the higher the compression ratio and the lower the compression speed. The default value is 6. --best is equivalent to -9, --fast is equivalent to -1 4. Common Examples (1) The original file is not compressed. gzip /etc/passwd The compressed /etc/passwd will become /etc/passwd.gz. (2) Keep the original file compression. gzip -c /etc/passwd > passwd.gz (3) Display the instruction execution process during compression. gzip -v /etc/passwd /etc/passwd: 57.9% -- replaced with /etc/passwd.gz (4) Decompress the .gz file without retaining the original file. gzip -dv /etc/passwd.gz /etc/passwd.gz: 57.9% -- replaced with /etc/passwd (5) Recursively compress all files in the specified directory. ls dir file1 file2 file3 gzip -rv dir dir/file3: -10.0% -- replaced with dir/file3.gz dir/file2: -25.0% -- replaced with dir/file2.gz dir/file1: -16.7% -- replaced with dir/file1.gz The above is the detailed content of the use of Linux gzip command. For more information about Linux gzip command, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: The difference between char and varchar in MYSQL
>>: js to achieve sliding carousel effect
I searched online and found that many interviews ...
This article shares with you how to install Kylin...
Create a table CREATE TABLE `map` ( `id` int(11) ...
Preface Tip: Here you can add the approximate con...
I found a strange problem when deploying the proj...
I have never been able to figure out whether the ...
Treemaps are mainly used to visualize tree-like d...
Table of contents Case Context switching overhead...
This article shares the specific code of a simple...
1. Download the pip installation package accordin...
Page turning problem scenario B and C are on the ...
Several concepts Line box: A box that wraps an in...
When building a database and writing a program, i...
Table of contents question: 1. Enable remote logi...
This article mainly introduces the case of Vue en...