百度首页 | 百度空间
 
查看文章
 
LFS中的Bzip2-1.0.3
2008-07-12 21:03

Bzip2 包含了对文件进行压缩和解压缩的工具,对于文本文件,bzip2 比传统的 gzip 拥有更高压缩比。

bunzip2

解压使用 bzip2 压缩的文件

bzcat

解压缩指定的文件到标准输出

bzcmp

对 bzip2 压缩的文件运行 cmp 命令

bzdiff

对 bzip2 压缩的文件运行 diff 命令

bzgrep

对 bzip2 压缩的文件运行 grep 命令

bzegrep

对 bzip2 压缩的文件运行 egrep 命令

bzfgrep

对 bzip2 压缩的文件运行 fgrep 命令

bzip2

使用 Burrows-Wheeler 块排列文本压缩算法和霍夫曼编码来压缩文件。压缩比要大于 gzip 工具使用的基于"Lempel-Ziv"的压缩算法(如 gzip 格式),接近 PPM 统计压缩算法族的压缩比。

bzip2recover

试图从被破坏的 bzip2 文件中恢复数据

bzless

对 bzip2 压缩的文件运行 less 命令

bzmore

对 bzip2 压缩的文件运行 more 命令

libbz2*

利用 Burrows-Wheeler 算法,实现无损块顺序数据压缩的库文件。

if ( test ! -d /tools/bin ) ; then mkdir -p /tools/bin ; fi
if ( test ! -d /tools/lib ) ; then mkdir -p /tools/lib ; fi
if ( test ! -d /tools/man ) ; then mkdir -p /tools/man ; fi
if ( test ! -d /tools/man/man1 ) ; then mkdir -p /tools/man/man1 ; fi
if ( test ! -d /tools/include ) ; then mkdir -p /tools/include ; fi
cp -f bzip2 /tools/bin/bzip2
cp -f bzip2 /tools/bin/bunzip2
cp -f bzip2 /tools/bin/bzcat
cp -f bzip2recover /tools/bin/bzip2recover
chmod a+x /tools/bin/bzip2
chmod a+x /tools/bin/bunzip2
chmod a+x /tools/bin/bzcat
chmod a+x /tools/bin/bzip2recover
cp -f bzip2.1 /tools/man/man1
chmod a+r /tools/man/man1/bzip2.1
cp -f bzlib.h /tools/include
chmod a+r /tools/include/bzlib.h
cp -f libbz2.a /tools/lib
chmod a+r /tools/lib/libbz2.a
cp -f bzgrep /tools/bin/bzgrep
ln /tools/bin/bzgrep /tools/bin/bzegrep
ln /tools/bin/bzgrep /tools/bin/bzfgrep
chmod a+x /tools/bin/bzgrep
cp -f bzmore /tools/bin/bzmore
ln /tools/bin/bzmore /tools/bin/bzless
chmod a+x /tools/bin/bzmore
cp -f bzdiff /tools/bin/bzdiff
ln /tools/bin/bzdiff /tools/bin/bzcmp
chmod a+x /tools/bin/bzdiff
cp -f bzgrep.1 bzmore.1 bzdiff.1 /tools/man/man1
chmod a+r /tools/man/man1/bzgrep.1
chmod a+r /tools/man/man1/bzmore.1
chmod a+r /tools/man/man1/bzdiff.1
echo ".so man1/bzgrep.1" > /tools/man/man1/bzegrep.1
echo ".so man1/bzgrep.1" > /tools/man/man1/bzfgrep.1
echo ".so man1/bzmore.1" > /tools/man/man1/bzless.1
echo ".so man1/bzdiff.1" > /tools/man/man1/bzcmp.1
这是make install 以后的信息。

看这几句:

cp -f bzip2 /tools/bin/bzip2
cp -f bzip2 /tools/bin/bunzip2
cp -f bzip2 /tools/bin/bzcat

bzip2,bunzip2,bzcat其实都是bzip2副本

但是运行的时候会产生不同一效果,很神奇,看这个:

[root@hacker tmp]# bzip2
bzip2: I won't write compressed data to a terminal.
bzip2: For help, type: `bzip2 --help'.

[root@hacker tmp]# bunzip2
bunzip2: I won't read compressed data from a terminal.
bunzip2: For help, type: `bunzip2 --help'.


[root@hacker tmp]# bzcat
bzcat: I won't read compressed data from a terminal.
bzcat: For help, type: `bzcat --help'.
虽然三个用的都是一个文件,不过文件名不同,效果不同。

我认为程序应该是判断自己的文件名来选择不同的函数运行。很有意思。。呵。

看用法吧。

bzip2 文件名 ;即被压缩

bunzip2 文件名.bz2 ;即被解压缩

bzip2 -d 等价于bunzip2

-f参数强制覆盖已存在的文件


类别:Lfs | 添加到搜藏 | 浏览() | 评论 (3)
 
最近读者:
 
网友评论:
1
2008-07-16 19:25
老弟
你懂这么多东西啊
佩服佩服啊
你懂Linux驱动开发吗?
想向你请教如何入门
QQ:410172928
 
2
2008-07-17 09:39
我啥都不懂。。。。哈。。瞎玩的呢
 
3
2008-07-17 10:46
你谦虚了!
依然一如既往的关注博主的文章,
我从中得到不少收益啊!
谢谢!
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu