Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common compression instructions for Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what are the common compression instructions in Linux". In daily operation, I believe many people have doubts about what the common compression instructions in Linux are. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what are the common compression instructions in Linux?" Next, please follow the editor to study!

Extension of compressed file in linux

Files compressed by * .Z compress program

*. Files compressed by the zip zip program

*. Files compressed by the gz gzip program

*. Files compressed by the bz2 bzip2 program

*. Files compressed by the xz xz program

The data packaged by the tar tar program has not been compressed.

*. Files packaged by tar.gz tar programs, which are compressed by gzip

*. Files packaged by tar.bz2 tar programs, which are compressed by bzip2

*. Files packaged by tar.xz tar programs, which are compressed by xz

1. Gzip,zcat/zmore/zless/zgrep

1.1 gzip directly zips files

Options and parameters:

-c: output compressed data to the screen, which can be processed by data stream redirection

-d: parameter for decompression

-t: can be used to check the consistency of a compressed file ~ to see if there are any errors in the file

-v: information such as the compression ratio of the original file / compressed file can be displayed

-#: # means a number and represents the compression level.-1 is the fastest, but the compression ratio is the worst,-9 is the slowest, but the compression ratio is the best! The default is-6

Example one

After gzip is passed, the original file will not exist.

1.2 compress the file and keep the source file

Pay attention to the spaces on both sides

1.3 decompress the file

Gzip-d compressed file

1.4 read compressed files with plain text

Zcat zmore zless is actually adding z before cat more less.

1.5 query the line of keywords in the compressed file

Zgrep-n 'Kaka' compressed file name

2. Bzip2,bzcat/bzmore/bzless/bzgrep

The usage of bzip2 and gzip are basically the same.

-c: output the data generated by the compression process to the screen!

-d: parameter for decompression

-k: keep the original file instead of deleting the original file!

-z: compressed parameter (default value, can not be added)

-v: information such as the compression ratio of the original file / compressed file can be displayed

-#: same as gzip, the parameters of compression ratio are calculated.-9 is the best, and-1 is the fastest!

3. Xz, xzcat/xzmore/xzless/xzgrep

The usage is basically the same as that of bzip2.

-d: just decompress it!

T: test the integrity of the compressed file to see if there are any errors

-l: lists information about compressed files

-k: keep the original file undeleted ~

C: similarly, it means to output data from the screen!

-#: similarly, it also means better compression ratio!

Summary

Since the following two uses are basically the same as gzip, you are not doing a demonstration, you can do it yourself. However, in the development process, it is recommended to use gzip.

If you don't think time is your cost consideration, then it's better to use xz!

If time is an important cost for you, then gzip is probably a more suitable compression software.

At this point, the study of "what are the common compression instructions for Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report