<Предыдущая | Содержание: | Следующая>
bzip2
Ассоциация bzip2 program, by Julian Seward, is similar to gzip, but uses a different compres- sion algorithm that achieves higher levels of compression at the cost of compression speed. In most regards, it works in the same fashion as GZIP. A file compressed with bzip2 is denoted with the extension . Bz2:
[я @ linuxbox ~] $ ls -l / etc> foo.txt
[я @ linuxbox ~] $ лс -л foo.txt
-rw-r - r-- 1 мне я 15738 2016 10:17 foo.txt [мне @ linuxbox ~] $ bzip2 foo.txt
[я @ linuxbox ~] $ ls -l foo.txt.bz2
-rw-r--r-- 1 me me 2792 2016-10-17 13:51 foo.txt.bz2 [me@linuxbox ~]$ bunzip2 foo.txt.bz2
[я @ linuxbox ~] $ ls -l / etc> foo.txt
[я @ linuxbox ~] $ лс -л foo.txt
-rw-r - r-- 1 мне я 15738 2016 10:17 foo.txt [мне @ linuxbox ~] $ bzip2 foo.txt
[я @ linuxbox ~] $ ls -l foo.txt.bz2
-rw-r--r-- 1 me me 2792 2016-10-17 13:51 foo.txt.bz2 [me@linuxbox ~]$ bunzip2 foo.txt.bz2
В свете вышеизложенного становится ясно, bzip2 can be used the same way as GZIP. All the options (except for
-r) that we discussed for gzip are also supported in bzip2. Note, however, that the compression level option (-номер) has a somewhat different meaning to bzip2. bzip2 comes with bunzip2 and bzcat for decompressing files.
bzip2 also comes with the bzip2recover program, which will try to recover dam- aged .bz2 files.
Don’t Be Compressive Compulsive
I occasionally see people attempting to compress a file, that has already been compressed with an effective compression algorithm, by doing something like this:
$ gzip picture.jpg
Don’t do it. You’re probably just wasting time and space! If you apply compres- sion to a file that is already compressed, you will actually end up with a larger file. This is because all compression techniques involve some overhead that is added to the file to describe the compression. If you try to compress a file that al- ready contains no redundant information, the compression will not result in any savings to offset the additional overhead.