初学者 Linux bzip2 命令教程(6 个示例)初学者 Linux bzip2 命令教程(6 个示例)初学者 Linux bzip2 命令教程(6 个示例)初学者 Linux bzip2 命令教程(6 个示例)
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

初学者 Linux bzip2 命令教程(6 个示例)

在此页

  1. Linux bzip2 命令
  2. Q1。如何使用 bzip2 压缩文件?
  3. Q2。如何使用 bzip2 压缩多个文件?
  4. Q3。如何使用bzip2解压?
  5. Q4。如何使 bzip2 不删除输入文件?
  6. Q5。如何使 bzip2 显示每个压缩操作的详细信息?
  7. Q6。如何检查压缩文件的完整性?
  8. 结论

文件压缩按照container.style.width=100%;var ins=document.createElement(ins);ins.id=slotId+-asloaded;ins.className=adsbygoogle ezasloaded;ins.dataset.adClient=pid;ins进行.dataset.adChannel=cid;if(ffid==2){ins.dataset.fullWidthResponsive=true;}

Linux bzip2 命令

bzip2 是 Linux 中基于命令行的文件压缩器,它使用 Burrows-Wheeler 块排序文本压缩算法和霍夫曼编码来执行压缩过程。以下是它的语法:

bzip2 [OPTIONS] filenames ...

这是手册页关于此工具的内容:

       bzip2  compresses  files  using  the Burrows-Wheeler block sorting text
       compression algorithm, and Huffman coding.   Compression  is  generally
       considerably   better   than   that   achieved   by  more  conventional
       LZ77/LZ78-based compressors, and approaches the performance of the  PPM
       family of statistical compressors.

       The  command-line options are deliberately very similar to those of GNU
       gzip, but they are not identical.

       bzip2 expects a list of file names to accompany the command-line flags.
       Each  file is replaced by a compressed version of itself, with the name
       "original_name.bz2".  Each compressed file has  the  same  modification
       date,  permissions,  and, when possible, ownership as the corresponding
       original, so that these properties can be correctly restored at  decom?
       pression  time.  File name handling is naive in the sense that there is
       no mechanism for preserving original file  names,  permissions,  owner?
       ships  or dates in filesystems which lack these concepts, or have seri?
       ous file name length restrictions, such as MS-DOS.

以下是一些 Q&A 风格的示例,可以让您对 bzip2 命令的工作原理有一个很好的了解。

Q1。如何使用 bzip2 压缩文件?

基本用法非常简单——只需将要压缩的文件作为输入传递给 bzip2 命令。这是一个例子:

bzip2 list.txt

以下屏幕截图显示了正在运行的命令:

Q2。如何使用 bzip2 压缩多个文件?

简单 - 只需将文件名作为输入传递。请参阅以下示例:

bzip2 list.txt list1.txt list2.txt

Q3.如何使用bzip2解压?

对于解压缩,请使用 -d 命令行选项。这是一个例子:

bzip2 -d list.txt.bz2

Q4.如何使 bzip2 不删除输入文件?

默认情况下,当 bzip2 压缩文件时,它会删除原始(或输入)文件。但是,如果您不希望发生这种情况,请使用 -k 命令行选项。

下面是一个例子:

Q5.如何使 bzip2 显示每个压缩操作的详细信息?

这可以使用 -v 命令行选项来完成。手册页是这样解释的:

-v --verbose
              Verbose  mode -- show the compression ratio for each file processed.  Further -v's
increase the verbosity level, spewing out lots of information which is primarily of
interest for diagnostic purposes.

以下是使用 -v 时显示 bzip2 命令输出的示例:

Q6.如何检查压缩文件的完整性?

bzip2 命令还可用于检查 .bz2 文件的完整性(一种确保文件未损坏或自创建后未更改的测试)。这可以使用 -t 命令行选项来完成。

-t --test
     Check  integrity of the specified file(s), but don't decompress them. 
This really performs a trial decompression and throws away the result.

结论

bzip2 命令行实用程序提供了更多选项,但我们在这里讨论的内容应该足以让您入门。练习完我们在本教程中讨论的选项后,您可以前往工具手册页了解更多信息。

©2015-2025 艾丽卡 support@alaica.com