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

Methods of Compression, packing and decompression of Files in Linux system

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

Share

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

This article mainly introduces the "compression, packaging and decompression methods of files under the Linux system". In the daily operation, I believe that many people have doubts about the compression, packaging and decompression of files under the Linux system. I have consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "the compression, packaging and decompression methods of files under the Linux system". Next, please follow the editor to study!

Zip and unzip for working with .zip files

Zip and unzip programs, located in the / usr/bin directory, have the same functions as pkzip, pkunzip, and MS-windows 's Winzip software under MS- DOS, which compress files into .zip files to save hard disk space, and unzip the compressed files when needed.

Zip command to compress files

Zip can be used to compress files, and if we have many files to compress, we can even process them together and compress them into a single file. The following is the syntax of zip and an introduction to the parameters available:

In fact, the most commonly used method of zip is to add the compressed file name and the file to be compressed.

Because the zip command is available on many OS platforms, and there are quite a number of parameters, I will only introduce a few parameters that are applicable to Linux:

-1: the fastest compression, the worst compression ratio.

-9: maximum compression, the best compression ratio.

-b: the path to the temporary file. This parameter usually occurs when the zip file to be generated exists and the hard disk runs out of space.

-c: add a line of comments to new or updated files.

-d: remove a file from the zip file.

-D: do not store directory information for files in zip files.

-f: replace existing documents with new ones.

-F: repair corrupted compressed files.

-g: attach the file compression to the zip file.

-h: displays auxiliary instructions.

-I: specifies some specific files to include.

-j: only the name of the file is saved, not the directory.

-k: force the use of file names in MSDOS format.

-l: convert CR (Carriage Return) LF (Line Feed) to LF. Generally, this parameter is used only when the text file on MS-DOS is compressed and used under UNIX. This applies only to text files (.txt), which can cause binary corruption if used in binaries.

-L: displays the copyright of the zip command.

-m: move a specific file into the zip file and delete the specific file.

-n: files with a specific extension are not compressed.

-o: set the time of the zip file to the time when the zip file was last modified.

-Q: quiet mode, no relevant messages and prompts are displayed.

-r: includes subdirectories.

-t: only files after the mmddyy date are processed.

-T: test whether the zip file is normal.

-u: update only changed files and new files.

-v: displays version information or detailed information.

-x: files that do not need to be compressed.

-y: compress the symbolic link instead of the file you link to.

-z: add comments to the zip file.

-#: set the compression speed.-0 means no compression, and-1 means the fastest compression.

-9 represents the slowest compression (optimized compression), with a default value of-6.

-@: reads the file name from standard input.

The unzip command to unzip a compressed file

The unzip command is used to unzip the .zip file, and the syntax of the unzip command is similar to zip, so the parameters are not detailed here.

Tar of the packaged fil

The tar program is located in the / usr/bin directory. The common compression method on UNIX is to first use tar to package many files (which may contain subdirectories) into a file (gzip and compess can only compress one file), and then compress gzip into xxx.tar.gz (or xxx.tgz) files for the second time.

Because there are so many parameters for tar, let me first introduce the common usage of tar:

Paul: ~ / tar cvf filesname.tar <-wrap all files as filesname.tar, and note that the extension .tar is added by itself.

Paul: ~ / tar cvzf filesname.tar.gz <-package all files into filesname.tar and compress them with gzip.

Paul: ~ / tar tvf filesname.tar <-check which files are included in the filesname.tar file.

Paul: ~ / tar xvf filesname.tar <-unlock the filesname.tar.

Archiver of KDE

KDE's archiver is like MS-wondows 's winzip, which can also unzip the compressed files of zip, gzip, tar, tar.gz, etc.

At this point, the study of "compression, packaging and decompression of files under the Linux system" is over. I hope to be able to solve everyone's 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

Servers

Wechat

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

12
Report