Linux / Unix Command: bzip2

Linux彩蛋:命令行里的Unix哲学与开源文化 Linux彩蛋并非玩笑代码,而是Unix哲学‘小而专、组合即能力’与开源协作精神在用户空间的具象表达。其原理根植于命令行工具的编译时硬编码、help系统自指机制及发行版定制策略,技术价值在于以零副作用方式传递设计意图、社区身份与构建溯源信息。典型应用场景包括包管理器(apt)、编辑器(vim)、编译工具(gcc)和系统服务(systemctl)等高频命令的交互反馈。理解彩蛋,本质是读懂Linux‘人本工程’的设计逻辑——从apt的超级奶牛到vim的vi兼容承诺,每一个彩蛋都是可执行的文档、可验证的契约。 阅读详情
Command Library

NAME

bzip2, bunzip2 - a block-sorting file compressor, v1.0.2
bzcat - decompresses files to stdout
bzip2recover - recovers data from damaged bzip2 files

EXAMPLES

SYNOPSIS

bzip2[ -cdfkqstvzVL123456789 ][ filenames ...]
bunzip2[ -fkvsVL ][ filenames ...]
bzcat[ -s ][ filenames ...]
bzip2recover filename

 

DESCRIPTION

bzip2compresses files using the Burrows-Wheeler block sortingtext compression algorithm, and Huffman coding. Compression isgenerally considerably better than that achieved by more conventionalLZ77/LZ78-based compressors, and approaches the performance of the PPMfamily of statistical compressors.

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

bzip2expects a list of file names to accompany thecommand-line flags. Each file is replaced by a compressed version ofitself, with the name "original_name.bz2". Each compressed filehas the same modification date, permissions, and, when possible,ownership as the corresponding original, so that these properties canbe correctly restored at decompression time. File name handling isnaive in the sense that there is no mechanism for preserving originalfile names, permissions, ownerships or dates in filesystems which lackthese concepts, or have serious file name length restrictions, such asMS-DOS.

bzip2andbunzip2will by default not overwrite existingfiles. If you want this to happen, specify the -f flag.

If no file names are specified,bzip2compresses from standardinput to standard output. In this case,bzip2will decline towrite compressed output to a terminal, as this would be entirelyincomprehensible and therefore pointless.

bunzip2(orbzip2 -d) decompresses allspecified files. Files which were not created by bzip2will be detected and ignored, and a warning issued. bzip2attempts to guess the filename for the decompressed file from that of the compressed file as follows:


       filename.bz2    becomes   filename
       filename.bz     becomes   filename
       filename.tbz2   becomes   filename.tar
       filename.tbz    becomes   filename.tar
       anyothername    becomes   anyothername.out

If the file does not end in one of the recognised endings, .bz2, .bz, .tbz2or.tbz, bzip2 complains that it cannotguess the name of the original file, and uses the original namewith.outappended.

As with compression, supplying nofilenames causes decompression from standard input to standard output.

bunzip2 will correctly decompress a file which is theconcatenation of two or more compressed files. The result is theconcatenation of the corresponding uncompressed files. Integritytesting (-t) of concatenated compressed files is also supported.

You can also compress or decompress files to the standard output bygiving the -c flag. Multiple files may be compressed anddecompressed like this. The resulting outputs are fed sequentially tostdout. Compression of multiple files in this manner generates a streamcontaining multiple compressed file representations. Such a streamcan be decompressed correctly only bybzip2 version 0.9.0 orlater. Earlier versions ofbzip2will stop after decompressingthe first file in the stream.

bzcat(orbzip2 -dc) decompresses all specified files tothe standard output.

bzip2will read arguments from the environment variablesBZIP2andBZIP,in that order, and will process thembefore any arguments read from the command line. This gives a convenient way to supply default arguments.

Compression is always performed, even if the compressed file is slightlylarger than the original. Files of less than about one hundred bytestend to get larger, since the compression mechanism has a constantoverhead in the region of 50 bytes. Random data (including the outputof most file compressors) is coded at about 8.05 bits per byte, givingan expansion of around 0.5%.

As a self-check for your protection, bzip2uses 32-bit CRCs tomake sure that the decompressed version of a file is identical to theoriginal. This guards against corruption of the compressed data, andagainst undetected bugs inbzip2(hopefully very unlikely). Thechances of data corruption going undetected is microscopic, about onechance in four billion for each file processed. Be aware, though, thatthe check occurs upon decompression, so it can only tell you thatsomething is wrong. It can't help you recover the original uncompresseddata. You can use bzip2recoverto try to recover data fromdamaged files.

Return values: 0 for a normal exit, 1 for environmental problems (filenot found, invalid flags, I/O errors, &c), 2 to indicate a corruptcompressed file, 3 for an internal consistency error (eg, bug) whichcausedbzip2to panic.

 

OPTIONS

-c --stdout
Compress or decompress to standard output.
-d --decompress
Force decompression. bzip2, bunzip2 and bzcat arereally the same program, and the decision about what actions to take isdone on the basis of which name is used. This flag overrides thatmechanism, and forces bzip2to decompress.
-z --compress
The complement to -d: forces compression, regardless of theinvocation name.
-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.
-f --force
Force overwrite of output files. Normally, bzip2 will not overwriteexisting output files. Also forces bzip2 to break hard linksto files, which it otherwise wouldn't do.

bzip2 normally declines to decompress files which don't have thecorrect magic header bytes. If forced (-f), however, it will passsuch files through unmodified. This is how GNU gzip behaves.

-k --keep
Keep (don't delete) input files during compressionor decompression.
-s --small
Reduce memory usage, for compression, decompression and testing. Filesare decompressed and tested using a modified algorithm which onlyrequires 2.5 bytes per block byte. This means any file can bedecompressed in 2300k of memory, albeit at about half the normal speed.

During compression, -s selects a block size of 200k, which limitsmemory use to around the same figure, at the expense of your compressionratio. In short, if your machine is low on memory (8 megabytes orless), use -s for everything. See MEMORY MANAGEMENT below.

-q --quiet
Suppress non-essential warning messages. Messages pertaining toI/O errors and other critical events will not be suppressed.
-v --verbose
Verbose mode -- show the compression ratio for each file processed.Further -v's increase the verbosity level, spewing out lots ofinformation which is primarily of interest for diagnostic purposes.
-L --license -V --version
Display the software version, license terms and conditions.
-1 (or --fast) to -9 (or --best)
Set the block size to 100 k, 200 k .. 900 k when compressing. Has noeffect when decompressing. See MEMORY MANAGEMENT below.The --fast and --best aliases are primarily for GNU gzip compatibility. In particular, --fast doesn't make thingssignificantly faster. And --best merely selects the default behaviour.
--
Treats all subsequent arguments as file names, even if they startwith a dash. This is so you can handle files with names beginningwith a dash, for example: bzip2 -- -myfilename.
--repetitive-fast --repetitive-best
These flags are redundant in versions 0.9.5 and above. They providedsome coarse control over the behaviour of the sorting algorithm inearlier versions, which was sometimes useful. 0.9.5 and above have animproved algorithm which renders these flags irrelevant.

 

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

Linux bzip2recover命令用法详解 Linux bzip2recover命令 Linux bzip2recover命令用来修复损坏的.bz2文件。 bzip2是以区块的方式来压缩文件,每个区块视为独立的单位。因此,当某一区块损坏时,便可利用bzip2recover,试着将文件中的区块隔开来,以便解压缩正常的区块。通常只适用在压缩文件很大的情况。 语法 bzip2recover [.bz2 压缩文件] 实例 修复.bz2文件 # bzip2recover col.bz2 立即下载

相关推荐

保姆级教程:用Docker Compose在Linux上一键部署Milvus 2.5.8(附配置文件详解)

本文提供了一份详细的Milvus 2.5.8安装指南,通过Docker Compose在Linux系统上一键部署这款高性能向量数据库。教程涵盖环境准备、配置文件解析、服务启动验证及常见问题解决,帮助开发者快速搭建AI应用所需的基础设施。

weixin_28829629的博客 269

命令-bzip2/bunzip2/bzcat

bzip2/bunzip2/bzcat命令【NAME】 bzip2, bunzip2 - a block-sorting file compressor, v1.0.6 bzcat - decompresses files to stdout bzip2recover - recovers data from damaged bzip2 files...

weixin_34345560的博客 165

sap 标准委外和工序委外_SAP PP 工序委外详解

在SAP里有外包和外协两种:外包:指把原材料发出去,扣减库存,然后供应商加工生产,最后再作为成品入库。主要是在MM模块下实现的。对应的英语叫Subcontracting。外协:一般是指某种工序外协,在工艺路线里设置某个工序为外协后,系统自动会产生一个采购订单,一般是指采购某种服务。采购回来后再继续本公司的其他工序。主要是在PP模块下实现的。对应的英语叫Processing。2.当有委外加工的业务流...

weixin_26849971的博客 4581

bzip2recover 修复tar.bz2大文件

bzip2recover archive.tar.bz2 bzip2 -tv rec*.bz2 > testoutput.log 2>&1 # split into folders at each broken bit bzip2 -dc rec*.bz2 > recovery1.tar bzip2 -dc rec*.bz2 > recovery2_failing.tar ./findtarheader.pl recovery2_failing.tar | hea...

hushui的专栏 3856

3-RRR并联机器人结构详解:从运动学到奇异点分析(附MATLAB仿真代码)

本文详细解析了3-RRR并联机器人的结构设计、运动学建模及奇异点分析,并提供了MATLAB仿真代码。通过对称性设计和可分析性,3-RRR结构成为教学与研究的理想对象。文章从基础杆件参数设置到奇异位形的实时捕捉,深入探讨了机构运动的数学本质,并分享了仿真调试中的实用技巧,助力工业自动化和精密控制应用。

sunny的博客 369

Information Fusion投稿避坑指南:从初稿到返修的完整流程解析(附模板下载)

本文详细解析了向Information Fusion投稿的全流程,从初稿准备到返修策略,涵盖了22个关键细节。特别强调了投稿前的隐形门槛、LaTeX模板的字体陷阱、图表规范要求以及返修回复的进阶技巧,帮助研究者避免常见错误,提升稿件接受率。附有实用模板下载,助力学术写作效率提升。

tgb34567890的博客 1421

bzip2: Data integrity error when decompressing--apt-get update

转:http://blog.sina.com.cn/s/blog_53689eaf01011mfn.html 参考上述网站 Ok everything fixed after this sudo apt-get clean  cd /var/lib/apt  sudo mv lists lists.old  sudo mkdir -p lists/partial  sudo ap

dengpaolide1的博客 4344

大模型安全-生成检测-事实核查-攻击-防御-思考-记忆-融合-语音相关研究 2025年版

本文整理了关于大模型安全领域的综合性资源,包括7篇综述论文、9个安全数据集以及5篇强化学习相关的安全研究论文。主要涉及大模型的对抗攻击、隐私保护、安全评估等方向,涵盖TruthfulQA、ToxiGen等知名数据集和TrustLLM、HarmBench等关键研究。资源包括知乎博主分享、arXiv预印本和顶会论文,并附有详细的中文讲解链接,为研究者提供了系统性的安全研究参考。

CSPhD-winston的博客 3592

linux环境没有bzip2,Linux bzip2 命令 command not found bzip2 命令详解 bzip2 命令未找到 bzip2 命令安装 - CommandNotFound ...

显示行号|选择喜欢的代码风格默认GitHubDuneLakeSidePlateauVibrantBlueEightiesTranquilbzip2 命令将文件压缩成 bz2 格式。bzip2 命令安装:-bash: bzip2: command not found#Debianapt-get install bzip2#Ubuntuapt-get install bzip2#若出现 configu...

weixin_35843812的博客 4443

深度学习实战102-基于深度学习的网络入侵检测系统,利用各种AI模型和pytorch框架实现网络入侵检测

在明确了研究背景后,我们需要设定明确的项目目标。本项目的核心目标是开发一个高精度、低延迟的网络入侵检测系统检测准确率:达到95%以上,确保系统能够有效识别各类已知和未知的入侵行为。响应时间:控制在毫秒级范围内,以实现实时监测和快速响应。模型鲁棒性:在面对不同类型的网络环境和攻击手法时,系统需保持稳定的性能输出。可扩展性:系统设计需考虑未来可能面临的新型威胁,便于后续升级和维护。

微学AI的博客 1793

【小白深度教程 1.32】手把手教你从多视角图像进行 3D 重建(SfM 算法)

重建的目标是从一组照片中推导场景的几何结构,假设摄像机位置和内部参数是已知的或可以从图像集中猜测。 这是通过使用多个照片,在其中应用运动结构法(Structure from Motion,SfM)来解决像素级对应问题,部分地恢复3D信息来实现的。

2401_87064292的博客 2160

Linux / Unix Command: bunzip2--reference

http://linux.about.com/library/cmd/blcmdl1_bunzip2.htm NAME bzip2, bunzip2 - a block-sorting file compressor, v1.0.2bzcat - decompresses files to stdoutbzip2recover - recovers data from damag...

133

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

linux/unix command

tar [-cxtzjvfpPN] 文件与目录 ....参数:-c :建立一个压缩文件的参数指令(create 的意思);-x :解开一个压缩文件的参数指令!-t :查看 tarfile 里面的文件!特别注意,在参数的下达中, c/x/t 仅能存在一个!不可同时存在!因为不可能同时压缩与解压缩。-z :是否同时具有 gzip 的属性?亦即是否需要用 gzip 压缩?-j :是否同时具有 bzip2...

weixin_30896763的博客 86

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

linux unix常见命令,Linux/Unix基本命令(二)

基本命令-2压缩和归档打包:即归档,类似于旅游之前收拾行李压缩:为了减少占用的磁盘空间,可以做备份,在网络上传输时节省网络带宽。打包压缩软件windows:winrar 360压缩 好压 7zip winziplinux:压缩格式:gz ,bz2,xz,zip,Z压缩算法不同,导致压缩比不同压缩软件 gzip bzip2 xz zip既能打包又能压缩的软件:tar ****一、zip:压缩后的文件...

weixin_39713219的博客 406

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

50 Most Frequently Used UNIX / Linux Commands (With Examples)

This article provides practical examples for 50 most frequently used commands in Linux / UNIX. This is not a comprehensive list by any means, but this should give you a jumpstart on some of the commo

Schen6 Online Life 1176

15+ tar command usages with examples – Unix/Linux--reference

reference :http://crybit.com/tar-command-usages-with-examples/ The ‘tar’ saves many files together into a single tape or disk archive, and can restore individual files from the archive. It is ve...

175

Linux zip command

From: http://blog.csdn.net/apaolove/article/details/2291155

fang_fang_2008的专栏 527

Linux/Unix 下常用解压缩命令

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33800593的博客 171

50个最常用的UNIX/Linux命令

转自http://get.jobdeer.com/493.get

JY_Sharer的专栏 1274

50个最常用的UNIX / Linux命令(结合实例)

本文提供了50最常用的命令在Linux / UNIX的实际例子。 收藏这篇文章供日后参考。 Did I miss any frequently used Linux commands? Leave a comment and let me know.   1. tar command examples Create a new tar archive. $ tar cvf archive...

yxhxj2006的专栏 596
上一篇: Hadoop HA Namenode remote access
下一篇: Hadoop 2.0 NameNode HA和Federation实践
迷途小码
博客等级 码龄19年 71粉丝 95原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值