linux mkdir命令,linux壓縮命令gzip_Linux gzip命令示例

 2023-11-19 阅读 23 评论 0

摘要:linux壓縮命令gzipLinux offers an array of tools for compressing and decompressing files. In this tutorial, we take a look at the Linux gzip command tool. Linux提供了一系列用于壓縮和解壓縮文件的工具。 在本教程中,我們將研究Linux gzip命令工具。 Gzip i

linux壓縮命令gzip

Linux offers an array of tools for compressing and decompressing files. In this tutorial, we take a look at the Linux gzip command tool.

Linux提供了一系列用于壓縮和解壓縮文件的工具。 在本教程中,我們將研究Linux gzip命令工具。

Gzip is a file format as well as a software application which was created by Mark Adler and Jean-Loup Gailly and has been in use since the early Unix Systems.

linux mkdir命令? Gzip是Mark Adler和Jean-Loup Gailly創建的一種文件格式以及一種軟件應用程序,自早期Unix Systems以來就一直在使用。

Linux gzip command uses the (LZ77) Lempel-Ziv coding during its operations. Let’s dive in and see the various examples of how Gzip can be used.

Linux gzip命令在操作期間使用(LZ77)Lempel-Ziv編碼。 讓我們深入了解如何使用Gzip的各種示例。

使用Linux gzip命令壓縮文件 (Compress a File using Linux gzip Command)

Compressing a file with gzip command is a walk in the park. Simply pass the file name as the argument as shown.

用gzip命令壓縮文件是在公園散步。 只需將文件名作為參數傳遞即可,如圖所示。

$ gzip [filename]

linux rmdir,The final compressed file acquires a suffix .gz.

最終的壓縮文件將獲得后綴.gz

For example, I have 4 text files in my current working directory as shown below.

例如,我當前的工作目錄中有4個文本文件,如下所示。

To compress file1.txt using gzip, the syntax will be.

linux grep。 要使用gzip壓縮file1.txt ,語法將是。

$ gzip file1.txt

To view the compressed file, use the ls command.

要查看壓縮文件,請使用ls命令。

Output

輸出量

shell解壓縮命令?It’s worth noting that the original text file has now been compressed and bears the .gz compression suffix.

值得注意的是,原始文本文件現已壓縮,并帶有.gz壓縮后綴。

強制gzip不替換/刪除原始文件 (Force gzip not to replace/delete the original file)

As we have seen in the previous example, gzip replaces the original file and turns it into a compressed file.
However, you can opt to retain the original file using the -k option as shown.

正如我們在前面的示例中看到的那樣,gzip替換了原始文件并將其轉換為壓縮文件。
但是,您可以選擇使用-k選項保留原始文件,如圖所示。

gzip -k [file-name]

For example, to compress file1.txt to a .gz file whie retaining the same file execute the command.

linux移動文件命令、 例如,要將file1.txt壓縮為保留相同文件的.gz文件,請執行以下命令。

$ gzip -k file1.txt

Be sure to verify using the ls command and note that the original file1.txt file is still present.

確保使用ls命令進行驗證,并注意原始的file1.txt文件仍然存在。

使用gzip遞歸壓縮文件 (Recursively compress files using gzip)

To compress all files recursively inside a directory, use the -r option as shown.

要遞歸壓縮目錄中的所有文件,請使用-r選項,如圖所示。

$ gzip -r *

centos解壓zip命令、For example, there are 4 text file inside the test folder as shown.

例如,如圖所示, 測試文件夾中有4個文本文件。

To compress all the files at a go run:

要一次性壓縮所有文件:

$ gzip -r *

Output

linux重命名文件命令, 輸出量

使用gzip解壓縮文件 (Uncompress a file using gzip)

If you want to uncompress a file, use the -d option a shown in the syntax below.

如果要解壓縮文件,請使用-d選項,語法如下所示。

$ gzip -d [compressed file-name]

For instance, to uncompress file1.txt.gz run:

例如,要解壓縮file1.txt.gz,請運行:

$ gzip -d file1.txt.gz

shell壓縮文件,Output

輸出量

As you can see, the original compressed file disappears.

如您所見,原始壓縮文件消失了。

列出使用gzip壓縮文件的詳細信息 (List details of a compressed file using gzip)

To list details of a compressed file make use of the -l option as shown.

linux查找文件命令。 要列出壓縮文件的詳細信息,請使用-l選項,如圖所示。

$ gzip -l [compressed-file-name]

For example,

例如,

$ gzip -l file1.txt.gz

Output

輸出量

如何調節gzip壓縮的速度 (How to Regulate Speed of gzip Compression)

linux?Gzip command also allows you to regulate the speed of compression. You can achieve this by specifying a hyphen (-) followed by a digit or number between 1 (Fastest) to 9 (Best). The default compression speed is 6.

Gzip命令還允許您調節壓縮速度。 您可以通過指定連字符(-)后接1(最快)到9(最佳)之間的數字或數字來實現此目的。 默認壓縮速度為6。

gzip -5 [file-name]

For instance:

例如:

gzip -5 file1.txt

You can use any digit/number between 1 and 9, where 1 denotes the fastest compression rate and 9 denotes the slowest compression rate but the most preferred.

gzip壓縮目錄命令。 您可以使用1到9之間的任何數字/數字,其中1表示最快的壓縮率,而9表示最慢的壓縮率,但最優選。

And that wraps up the gzip command usage. Feel free to share your thoughts on this. Your feedback is most welcome.

這樣就結束了gzip命令的用法。 隨時分享您的想法。 非常歡迎您提供反饋。

翻譯自: https://www.journaldev.com/30260/linux-gzip-command-examples

linux壓縮命令gzip

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/183264.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息