[root@hf-01 d6z]# du -sh 1.txt 2.0M 1.txt [root@hf-01 d6z]# bzip2 1.txt [root@hf-01 d6z]# ls 1.txt.bz2 [root@hf-01 d6z]# du -sh 1.txt.bz2 168K 1.txt.bz2
[root@hf-01 d6z]# bzip2 -d 1.txt.bz2 [root@hf-01 d6z]# ls 1.txt [root@hf-01 d6z]# du -sh 1.txt 1.5M 1.txt
[root@hf-01 d6z]# bunzip2 1.txt.bz2 [root@hf-01 d6z]# ls 1.txt
[root@hf-01 d6z]# bzip2 -c 1.txt > /tmp/2.txt.bz2 [root@hf-01 d6z]# du -sh /tmp/2.txt.bz2 168K /tmp/2.txt.bz2
[root@hf-01 d6z]# bzip2 -d -c /tmp/2.txt.bz2 > 4.txt [root@hf-01 d6z]# ls 1.txt 4.txt [root@hf-01 d6z]# du -sh 4.txt 1.5M 4.txt
[root@hf-01 d6z]# bunzip2 1.txt.bz2 > 5.txt [root@hf-01 d6z]# ls 1.txt 4.txt 5.txt
[root@hf-01 d6z]# file 1.txt.bz2 1.txt.bz2: bzip2 compressed data, block size = 900k
[root@hf-01 d6z]# bzcat 1.txt.bz2
查看的时候,需注意压缩文件是否为空,若为空,则看不到什么文件less