Awalnya dibuat oleh Julian Seward, bzip2 adalah utilitas kompresi data open source gratis. Berguna untuk mengurangi ukuran file sehingga lebih banyak file yang dapat disimpan atau file dapat ditransfer dengan cepat. Juga, ini membantu file pulih dari beberapa kesalahan media (disk buruk). Utilitas bzip2 bebas paten dan tersedia untuk komersial. Ini menggunakan algoritma Burrows-Wheeler, yang menggantikan set karakter duplikat dan saat ini dikelola oleh Mark Wielaard dan Micah Snyder.
Ketika file dikompresi dengan bzip2, mereka mendapatkan .bz2 ekstensi file.
Cara menginstal bzip2
Petunjuk untuk menginstal bzip2 terletak di file README yang disertakan dengan file instalasi. Ini mengkompilasi seperti file C dan C++ menggunakan kompiler ANSI C. Pada contoh di bawah ini, bzip2 diinstal ke /Pengguna/ch/bzip2-1.0.8 alih-alih direktori default.
[email protected] ~/bzip2-1.0.8 : make install PREFIX=/Users/ch/bzip2-1.0.8
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c bzip2recover.c
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -o bzip2recover bzip2recover.o
if ( test ! -d /Users/ch/bzip2-1.0.8/bin ) ; then mkdir -p /Users/ch/bzip2-1.0.8/bin ; fi
if ( test ! -d /Users/ch/bzip2-1.0.8/lib ) ; then mkdir -p /Users/ch/bzip2-1.0.8/lib ; fi
if ( test ! -d /Users/ch/bzip2-1.0.8/man ) ; then mkdir -p /Users/ch/bzip2-1.0.8/man ; fi
if ( test ! -d /Users/ch/bzip2-1.0.8/man/man1 ) ; then mkdir -p /Users/ch/bzip2-1.0.8/man/man1 ; fi
if ( test ! -d /Users/ch/bzip2-1.0.8/include ) ; then mkdir -p /Users/ch/bzip2-1.0.8/include ; fi
cp -f bzip2 /Users/ch/bzip2-1.0.8/bin/bzip2
cp -f bzip2 /Users/ch/bzip2-1.0.8/bin/bunzip2
cp -f bzip2 /Users/ch/bzip2-1.0.8/bin/bzcat
cp -f bzip2recover /Users/ch/bzip2-1.0.8/bin/bzip2recover
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzip2
chmod a+x /Users/ch/bzip2-1.0.8/bin/bunzip2
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzcat
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzip2recover
cp -f bzip2.1 /Users/ch/bzip2-1.0.8/man/man1
chmod a+r /Users/ch/bzip2-1.0.8/man/man1/bzip2.1
cp -f bzlib.h /Users/ch/bzip2-1.0.8/include
chmod a+r /Users/ch/bzip2-1.0.8/include/bzlib.h
cp -f libbz2.a /Users/ch/bzip2-1.0.8/lib
chmod a+r /Users/ch/bzip2-1.0.8/lib/libbz2.a
cp -f bzgrep /Users/ch/bzip2-1.0.8/bin/bzgrep
ln -s -f /Users/ch/bzip2-1.0.8/bin/bzgrep /Users/ch/bzip2-1.0.8/bin/bzegrep
ln -s -f /Users/ch/bzip2-1.0.8/bin/bzgrep /Users/ch/bzip2-1.0.8/bin/bzfgrep
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzgrep
cp -f bzmore /Users/ch/bzip2-1.0.8/bin/bzmore
ln -s -f /Users/ch/bzip2-1.0.8/bin/bzmore /Users/ch/bzip2-1.0.8/bin/bzless
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzmore
cp -f bzdiff /Users/ch/bzip2-1.0.8/bin/bzdiff
ln -s -f /Users/ch/bzip2-1.0.8/bin/bzdiff /Users/ch/bzip2-1.0.8/bin/bzcmp
chmod a+x /Users/ch/bzip2-1.0.8/bin/bzdiff
cp -f bzgrep.1 bzmore.1 bzdiff.1 /Users/ch/bzip2-1.0.8/man/man1
chmod a+r /Users/ch/bzip2-1.0.8/man/man1/bzgrep.1
chmod a+r /Users/ch/bzip2-1.0.8/man/man1/bzmore.1
chmod a+r /Users/ch/bzip2-1.0.8/man/man1/bzdiff.1
echo ".so man1/bzgrep.1" > /Users/ch/bzip2-1.0.8/man/man1/bzegrep.1
echo ".so man1/bzgrep.1" > /Users/ch/bzip2-1.0.8/man/man1/bzfgrep.1
echo ".so man1/bzmore.1" > /Users/ch/bzip2-1.0.8/man/man1/bzless.1
echo ".so man1/bzdiff.1" > /Users/ch/bzip2-1.0.8/man/man1/bzcmp.1
[email protected] ~/bzip2-1.0.8
Jika Anda melihat banyak peringatan atau kesalahan kompilasi, Anda harus memperbaikinya. Anda dapat mencari di Internet untuk kesalahan spesifik dan membuat perubahan yang diperlukan. Misalnya, pada Mac M1 Max, %L tidak didukung dan perlu diubah menjadi %ll. Menggunakan %L menghasilkan peringatan berikut.
Untuk memperbaikinya, ubah bzip2recover.c, ganti definisikan MaybeUInt64_FMT “%Lu” dengan tentukan MaybeUInt64_FMT “%llu”.
Cara mengompres file menggunakan bzip2
Untuk mengompresi file, gunakan baris perintah atau terminal dan ubah ke direktori dengan file yang ingin Anda kompres. Lari bzip2 -z [files].
[email protected] ~ : cd tmp
[email protected] ~/tmp : ls
[email protected] 6.1k ch 16 Jul 08:21 .DS_Store
[email protected] 282k ch 8 May 11:44 bowl_floral.jpg
[email protected] 261k ch 8 May 11:55 bowl_floral_final.jpg
[email protected] 9.9M ch 23 Apr 14:52 bubble_flower.jpg
[email protected] 8.1M ch 23 Apr 14:52 bubble_flower_final.jpg
[email protected] 1.1M ch 22 Mar 16:39 canvas_test.jpg
[email protected] 1.2M ch 22 Mar 16:39 canvas_test_final.jpg
[email protected] 430k ch 8 May 20:17 cat_in_window.jpg
[email protected] 779k ch 10 Jun 21:08 flame_thing.jpg
[email protected] 747k ch 10 Jun 21:13 flame_thing_final.jpg
[email protected] 2.5M ch 9 Jun 13:05 floral_20220609.jpg
[email protected] 2.1M ch 9 Jun 13:05 floral_20220609_final.jpg
[email protected] 5.0M ch 11 Jun 20:20 img_4167_custom_final.jpg
[email protected] 2.1M ch 16 May 19:43 No_Fill.jpg
.rw-r--r-- 2.4M ch 16 May 19:58 no_fill_final.jpg
.rw-r--r-- 533k ch 19 Mar 17:12 quick_study_final.jpg
[email protected] 314k ch 16 Apr 15:03 replace_household_items.jpg
[email protected] 371k ch 8 May 07:43 stone_floral.jpg
[email protected] 411k ch 8 May 07:44 stone_floral_final.jpg
[email protected] ~/tmp : du
75472 .
[email protected] ~/tmp : bzip2 -z *
[email protected] ~/tmp : ls
[email protected] 6.1k ch 16 Jul 08:21 .DS_Store
.rw-r--r-- 271k ch 8 May 11:44 bowl_floral.jpg.bz2
[email protected] 242k ch 8 May 11:55 bowl_floral_final.jpg.bz2
.rw-r--r-- 9.9M ch 23 Apr 14:52 bubble_flower.jpg.bz2
[email protected] 7.9M ch 23 Apr 14:52 bubble_flower_final.jpg.bz2
.rw-r--r-- 1.1M ch 22 Mar 16:39 canvas_test.jpg.bz2
[email protected] 1.2M ch 22 Mar 16:39 canvas_test_final.jpg.bz2
[email protected] 297k ch 8 May 20:17 cat_in_window.jpg.bz2
.rw-r--r-- 759k ch 10 Jun 21:08 flame_thing.jpg.bz2
[email protected] 728k ch 10 Jun 21:13 flame_thing_final.jpg.bz2
.rw-r--r-- 2.5M ch 9 Jun 13:05 floral_20220609.jpg.bz2
[email protected] 2.0M ch 9 Jun 13:05 floral_20220609_final.jpg.bz2
[email protected] 4.9M ch 11 Jun 20:20 img_4167_custom_final.jpg.bz2
.rw-r--r-- 1.8M ch 16 May 19:43 No_Fill.jpg.bz2
.rw-r--r-- 2.0M ch 16 May 19:58 no_fill_final.jpg.bz2
.rw-r--r-- 509k ch 19 Mar 17:12 quick_study_final.jpg.bz2
[email protected] 271k ch 16 Apr 15:03 replace_household_items.jpg.bz2
[email protected] 351k ch 8 May 07:43 stone_floral.jpg.bz2
[email protected] 394k ch 8 May 07:44 stone_floral_final.jpg.bz2
[email protected] ~/tmp : du
72456 .
[email protected] ~/tmp :
CD – ubah direktori
ls atau dir – daftar file
du – penggunaan disk (ukuran file) di Linux
* – singkatan untuk semua file
Cara membuka kompres file menggunakan bzip2
Untuk membuka kompres file, gunakan baris perintah atau terminal dan ubah ke direktori dengan file yang ingin Anda uncompress. Lari bunzip2 [files].
[email protected] ~/tmp : ls
[email protected] 6.1k ch 16 Jul 08:21 .DS_Store
.rw-r--r-- 271k ch 8 May 11:44 bowl_floral.jpg.bz2
[email protected] 242k ch 8 May 11:55 bowl_floral_final.jpg.bz2
.rw-r--r-- 9.9M ch 23 Apr 14:52 bubble_flower.jpg.bz2
[email protected] 7.9M ch 23 Apr 14:52 bubble_flower_final.jpg.bz2
.rw-r--r-- 1.1M ch 22 Mar 16:39 canvas_test.jpg.bz2
[email protected] 1.2M ch 22 Mar 16:39 canvas_test_final.jpg.bz2
[email protected] 297k ch 8 May 20:17 cat_in_window.jpg.bz2
.rw-r--r-- 759k ch 10 Jun 21:08 flame_thing.jpg.bz2
[email protected] 728k ch 10 Jun 21:13 flame_thing_final.jpg.bz2
.rw-r--r-- 2.5M ch 9 Jun 13:05 floral_20220609.jpg.bz2
[email protected] 2.0M ch 9 Jun 13:05 floral_20220609_final.jpg.bz2
[email protected] 4.9M ch 11 Jun 20:20 img_4167_custom_final.jpg.bz2
.rw-r--r-- 1.8M ch 16 May 19:43 No_Fill.jpg.bz2
.rw-r--r-- 2.0M ch 16 May 19:58 no_fill_final.jpg.bz2
.rw-r--r-- 509k ch 19 Mar 17:12 quick_study_final.jpg.bz2
[email protected] 271k ch 16 Apr 15:03 replace_household_items.jpg.bz2
[email protected] 351k ch 8 May 07:43 stone_floral.jpg.bz2
[email protected] 394k ch 8 May 07:44 stone_floral_final.jpg.bz2
[email protected] ~/tmp : du
72456 .
[email protected] ~/tmp : bunzip2 *
[email protected] ~/tmp : ls
[email protected] 6.1k ch 16 Jul 08:21 .DS_Store
.rw-r--r-- 282k ch 8 May 11:44 bowl_floral.jpg
[email protected] 261k ch 8 May 11:55 bowl_floral_final.jpg
.rw-r--r-- 9.9M ch 23 Apr 14:52 bubble_flower.jpg
[email protected] 8.1M ch 23 Apr 14:52 bubble_flower_final.jpg
.rw-r--r-- 1.1M ch 22 Mar 16:39 canvas_test.jpg
[email protected] 1.2M ch 22 Mar 16:39 canvas_test_final.jpg
[email protected] 430k ch 8 May 20:17 cat_in_window.jpg
.rw-r--r-- 779k ch 10 Jun 21:08 flame_thing.jpg
[email protected] 747k ch 10 Jun 21:13 flame_thing_final.jpg
.rw-r--r-- 2.5M ch 9 Jun 13:05 floral_20220609.jpg
[email protected] 2.1M ch 9 Jun 13:05 floral_20220609_final.jpg
[email protected] 5.0M ch 11 Jun 20:20 img_4167_custom_final.jpg
.rw-r--r-- 2.1M ch 16 May 19:43 No_Fill.jpg
.rw-r--r-- 2.4M ch 16 May 19:58 no_fill_final.jpg
.rw-r--r-- 533k ch 19 Mar 17:12 quick_study_final.jpg
[email protected] 314k ch 16 Apr 15:03 replace_household_items.jpg
[email protected] 371k ch 8 May 07:43 stone_floral.jpg
[email protected] 411k ch 8 May 07:44 stone_floral_final.jpg
[email protected] ~/tmp : du
75472 .
[email protected] ~/tmp :
Menggunakan bzip2 dengan tar
Untuk mengompresi atau memperluas a ter arsip bernama arsip.tar.bz2 yang dikompres dengan bzip2, tentukan -j atau –bzip2 pilihan. (Perhatikan bahwa ter memungkinkan Anda menentukan bentuk opsi pendek tanpa tanda hubung.)
Misalnya, untuk mengekstrak file dari arsip tar yang dikompresi dengan bzip2, Anda dapat menggunakan perintah berikut:
tar --extract --bzip2 --file archive.tar.bz2
Atau, menggunakan bentuk singkat dari opsi tersebut:
tar xjf archive.tar.bz2
Untuk membuat arsip tar folder harapan di direktori saat ini, dan kompres dengan bzip2:
tar --create --bzip2 --file hope.tar.bz2 hope/
Atau, menggunakan opsi singkat:
tar cjf hope.tar.bz2 hope/
Pada beberapa versi ter, seperti versi default yang diinstal di macOS, kompresi bzip secara otomatis terdeteksi saat mengekstrak file dari arsip. Pada versi itu teritu -j / –bzip2 opsi tidak diperlukan saat menggunakan -x / –ekstrak pilihan.
File terkompresi, Utilitas kompresi, Crunch, Data, Meledak, Ekstrak, Gzip, Perintah cc Linux, Persyaratan sistem operasi, Kemas, RAR, Barang, Buka kompresi, Zip