Get the App
SLTechnology News&Howtos  ›  Servers  › 

Example usage of zip Compression and decompression Command in Linux

Shulou Source: shulou.com Published: 2022-06-01 14:22:24 10月02日 Update

This article mainly introduces "the example usage of zip compression and decompression command in Linux". In daily operation, I believe that many people have doubts about the usage of zip compression and decompression command examples in Linux. The editor 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 "zip compression and decompression command instance usage in Linux". Next, please follow the editor to study!

1. Compress ordinary files

Format: zip archive name source file

Ls#bk Common desktop.ini develop my little movie .txtzip nothing to see .zip my little movie .txt # adding: my little movie .txt (deflated 27%) ls#bk Common desktop.ini develop my little movie .txt nothing to see .zip

Summary: commands in the format of zip zip package name source file retain the source file's

2. Compress the directory

Format: zip-r compressed package name source directory

Pwd#/mnt/c/Users/bingobugbow/Desktop/ I am the directory cd.. ls#bk Common desktop.ini develop I am the directory zip-r directory. Zip I am the directory / # adding: I am the directory / (stored 0%) # adding: I am the directory / my little movie .txt (deflated 27%) # adding: I am the directory / nothing to see .zip (stored 0%) ls#bk Common desktop.ini develop I am the directory .zip

Summary: the source directory is also retained

3. Decompress ordinary files

Format: unzip package

Ls# nothing to see .zipunzip nothing to see .zip # Archive: nothing to look at .zip # inflating: my little movie .txtls # my little movie .txt nothing to see .zip

Conclusion: when decompressing, the original compressed package will also exist, which is equivalent to taking out the contents of the compressed package.

4. Decompress the directory

Format: unzip package

Ls#bk Common desktop.ini develop directory .zipunzip directory .zip # Archive: directory .zip # creating: I am directory / # inflating: I am directory / my little movie .txt # extracting: I am directory / nothing look .zipls # bk Common desktop.ini develop I am directory .zip

Summary: as with the unzipped files, the source package will be retained

Zip decompression and compression in this case without any parameters (- r, and when decompression, the directory does not need to add-r) parameters are excluded. Will keep the source file. The source file here refers to the source compressed file and the compressed package that has been compressed.

At this point, the study on the "zip compression and decompression command instance usage in 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!

Tags: Directory small movie command format source file instance file study name normal parameter time more source directory help practical next don't use thing situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei Linux Shulou Information vpn