Bzip2 command
Author: s | 2025-04-24
Compressing with bzip2 The bzip2 command also compresses data. Syntax of the bzip2 command: bzip2 [options] [file] Example: $ bzip2 usr.cpio $ ls usr.cpio.bz2 The file Bzip2 Command. The ‘bzip2’ command is used to compress and decompress files using the Bzip2 compression algorithm. To decompress a .tar.bz2 file with ‘bzip2’, you need to
BZIP2 Command - Create bzip2 compressed archives - jpsoft.com
To compress a file(s), is to significantly decrease the size of the file(s) by encoding data in the file(s) using less bits, and it is normally a useful practice during backup and transfer of a file(s) over a network. On the other hand, decompressing a file(s) means restoring data in the file(s) to its original state.Suggested Read: Learn Linux ‘tar’ Command with This 18 ExamplesThere are several file compression and decompression tools available in Linux such as gzip, 7-zip, Lrzip, PeaZip and many more.In this tutorial, we will look at how to compress and decompress .bz2 files using the bzip2 tool in Linux.Bzip2 is a well known compression tool and it’s available on most if not all the major Linux distributions, you can use the appropriate command for your distribution to install it.$ sudo apt install bzip2 [On Debian/Ubuntu] $ sudo yum install bzip2 [On CentOS/RHEL]$ sudo dnf install bzip2 [On Fedora 22+]The conventional syntax of using bzip2 is:$ bzip2 option(s) filenames How to Use “bzip2” to Compress Files in LinuxYou can compress a file as below, where the flag -z enables file compression:$ bzip2 filenameOR$ bzip2 -z filenameTo compress a .tar file, use the command format:$ bzip2 -z backup.tarImportant: By default, bzip2 deletes the input files during compression or decompression, to keep the input files, use the -k or --keep option.In addition, the -f or --force flag will force bzip2 to overwrite an existing output file.------ To keep input file ------$ bzip2 -zk filename$ bzip2 -zk backup.tarYou can as well set the block size to 100k upto 900k, using -1 or --fast to -9 or –best as shown in the below examples:$ bzip2 -k1 Etcher-linux-x64.AppImage$ ls -lh Etcher-linux-x64.AppImage.bz2 $ bzip2 -k9 Etcher-linux-x64.AppImage $ bzip2 -kf9 Etcher-linux-x64.AppImage $ ls -lh Etcher-linux-x64.AppImage.bz2 The screenshot below shows how to use options to keep the input file, force bzip2 to overwrite an output file and set the block size during compression.Compress Files Using bzip2 in LinuxHow to Use “bzip2” to Decompress Files in LinuxTo decompress a .bz2 file, make use of the -d or --decompress option like so:$ bzip2 -d filename.bz2Note: The file must end with a .bz2 extension for the command above to work.$ bzip2 -vd Etcher-linux-x64.AppImage.bz2 $ bzip2 -vfd Etcher-linux-x64.AppImage.bz2 $ ls -l Etcher-linux-x64.AppImage Decompress bzip2 File in LinuxTo view the bzip2 help page and man page, type the command below:$ bzip2 -h$ man bzip2Lastly, with the simple elaborations above, I believe you are now capable of compressing and decompressing .bz2 files using the bzip2 tool in Linux. However, for any questions or feedback, reach us using the comment section below.Importantly, you may want to go over a few important Tar command examples in Linux so as to learn using the tar utility to create compressed archive files.. Compressing with bzip2 The bzip2 command also compresses data. Syntax of the bzip2 command: bzip2 [options] [file] Example: $ bzip2 usr.cpio $ ls usr.cpio.bz2 The file Bzip2 Command. The ‘bzip2’ command is used to compress and decompress files using the Bzip2 compression algorithm. To decompress a .tar.bz2 file with ‘bzip2’, you need to Bzip2 takes time to compress. Bzip2 extension is .bz2 bzip2 file_name (This command used to compress the file with extension .bz2) Uncompress bzip2 command Let s install bzip2 using the following yum command: yum install bzip2. I can confirm that the bzip2 binary exists using the which command: [myuser@localhost]$ which bzip2 /usr/bin/bzip2. And the command to create compressed archives using bzip2 is the following: Ensure that you have the bzip2 and bzip2-libs RPMs installed. It looks like the tar command defers to the bzip2 command which the bzip2 RPM provides (/usr/bin/bzip2).In your case, tar Ensure that you have the bzip2 and bzip2-libs RPMs installed. It looks like the tar command defers to the bzip2 command which the bzip2 RPM provides (/usr/bin/bzip2).In your case, tar Dec 18, 2015Parallel BZIP2 v1.1.13 - by: Jeff Gilchrist Available at: is the README for pbzip2, a parallel implementation of thebzip2 block-sorting file compressor. The output of this versionshould be fully compatible with bzip2 v1.0.2 or newer (ie: anythingcompressed with pbzip2 can be decompressed with bzip2).pbzip2 is distributed under a BSD-style license. For details,see the file COPYING.1. HOW TO BUILD -- UNIXType `make'. This builds the pbzip2 program and dynamicallylinks to the libbzip2 library. You should ensure that you haveat least libbzip2 1.0.5 or newer installed as it contains someimportant security bug fixes.If you do not have libbzip2 installed on your system, you shouldfirst go to and install it.Debian users need the package "libbz2-dev". If you want toinstall a pre-built package on Debian, run the following command:'apt-get update; apt-get install pbzip2'If you would like to build pbzip2 with a statically linkedlibbzip2 library, download the bzip2 source from the above site,compile it, and copy the libbz2.a and bzlib.h files into thepbzip2 source directory. Then type `make pbzip2-static'.Note: This software has been tested on Linux (Intel, Alpha), Solaris (Sparc), HP-UX, Irix (SGI), and Tru64/OSF1 (Alpha).2. HOW TO BUILD -- WindowsOn Windows, pbzip2 can be compiled using Cygwin.If you do not have libbzip2 installed on your system, you shouldfirst go to and install it.Cygwin can be found at: a Cygwin shell, go to the directory where the pbzip2 sourcefiles are located and type `make'. This builds the pbzip2program and dynamically links to the libbzip2 library.If you would like to build pbzip2 with a statically linkedlibbzip2 library, download the bzip2 source from the above site,compile it, and copy the libbz2.a file into the pbzip2 sourcedirectory. Then type `make pbzip2-static'.3. DISCLAIMER I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE USE OF THIS PROGRAM, HOWSOEVER CAUSED. DO NOT COMPRESS ANY DATA WITH THIS PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.* Portions of this README were copied directly from the bzip2 README written by Julian Seward. 4. PBZIP2 DATA FORMATYou should be able to compress files larger than 4GB with pbzip2.Files that are compressed with pbzip2 are broken up into pieces andeach individual piece is compressed. This is how pbzip2 runs fasteron multiple CPUs since the pieces can be compressed simultaneously.The final .bz2 file may be slightly larger than if it was compressedwith the regular bzip2 program due to this file splittingComments
To compress a file(s), is to significantly decrease the size of the file(s) by encoding data in the file(s) using less bits, and it is normally a useful practice during backup and transfer of a file(s) over a network. On the other hand, decompressing a file(s) means restoring data in the file(s) to its original state.Suggested Read: Learn Linux ‘tar’ Command with This 18 ExamplesThere are several file compression and decompression tools available in Linux such as gzip, 7-zip, Lrzip, PeaZip and many more.In this tutorial, we will look at how to compress and decompress .bz2 files using the bzip2 tool in Linux.Bzip2 is a well known compression tool and it’s available on most if not all the major Linux distributions, you can use the appropriate command for your distribution to install it.$ sudo apt install bzip2 [On Debian/Ubuntu] $ sudo yum install bzip2 [On CentOS/RHEL]$ sudo dnf install bzip2 [On Fedora 22+]The conventional syntax of using bzip2 is:$ bzip2 option(s) filenames How to Use “bzip2” to Compress Files in LinuxYou can compress a file as below, where the flag -z enables file compression:$ bzip2 filenameOR$ bzip2 -z filenameTo compress a .tar file, use the command format:$ bzip2 -z backup.tarImportant: By default, bzip2 deletes the input files during compression or decompression, to keep the input files, use the -k or --keep option.In addition, the -f or --force flag will force bzip2 to overwrite an existing output file.------ To keep input file ------$ bzip2 -zk filename$ bzip2 -zk backup.tarYou can as well set the block size to 100k upto 900k, using -1 or --fast to -9 or –best as shown in the below examples:$ bzip2 -k1 Etcher-linux-x64.AppImage$ ls -lh Etcher-linux-x64.AppImage.bz2 $ bzip2 -k9 Etcher-linux-x64.AppImage $ bzip2 -kf9 Etcher-linux-x64.AppImage $ ls -lh Etcher-linux-x64.AppImage.bz2 The screenshot below shows how to use options to keep the input file, force bzip2 to overwrite an output file and set the block size during compression.Compress Files Using bzip2 in LinuxHow to Use “bzip2” to Decompress Files in LinuxTo decompress a .bz2 file, make use of the -d or --decompress option like so:$ bzip2 -d filename.bz2Note: The file must end with a .bz2 extension for the command above to work.$ bzip2 -vd Etcher-linux-x64.AppImage.bz2 $ bzip2 -vfd Etcher-linux-x64.AppImage.bz2 $ ls -l Etcher-linux-x64.AppImage Decompress bzip2 File in LinuxTo view the bzip2 help page and man page, type the command below:$ bzip2 -h$ man bzip2Lastly, with the simple elaborations above, I believe you are now capable of compressing and decompressing .bz2 files using the bzip2 tool in Linux. However, for any questions or feedback, reach us using the comment section below.Importantly, you may want to go over a few important Tar command examples in Linux so as to learn using the tar utility to create compressed archive files.
2025-04-01Dec 18, 2015Parallel BZIP2 v1.1.13 - by: Jeff Gilchrist Available at: is the README for pbzip2, a parallel implementation of thebzip2 block-sorting file compressor. The output of this versionshould be fully compatible with bzip2 v1.0.2 or newer (ie: anythingcompressed with pbzip2 can be decompressed with bzip2).pbzip2 is distributed under a BSD-style license. For details,see the file COPYING.1. HOW TO BUILD -- UNIXType `make'. This builds the pbzip2 program and dynamicallylinks to the libbzip2 library. You should ensure that you haveat least libbzip2 1.0.5 or newer installed as it contains someimportant security bug fixes.If you do not have libbzip2 installed on your system, you shouldfirst go to and install it.Debian users need the package "libbz2-dev". If you want toinstall a pre-built package on Debian, run the following command:'apt-get update; apt-get install pbzip2'If you would like to build pbzip2 with a statically linkedlibbzip2 library, download the bzip2 source from the above site,compile it, and copy the libbz2.a and bzlib.h files into thepbzip2 source directory. Then type `make pbzip2-static'.Note: This software has been tested on Linux (Intel, Alpha), Solaris (Sparc), HP-UX, Irix (SGI), and Tru64/OSF1 (Alpha).2. HOW TO BUILD -- WindowsOn Windows, pbzip2 can be compiled using Cygwin.If you do not have libbzip2 installed on your system, you shouldfirst go to and install it.Cygwin can be found at: a Cygwin shell, go to the directory where the pbzip2 sourcefiles are located and type `make'. This builds the pbzip2program and dynamically links to the libbzip2 library.If you would like to build pbzip2 with a statically linkedlibbzip2 library, download the bzip2 source from the above site,compile it, and copy the libbz2.a file into the pbzip2 sourcedirectory. Then type `make pbzip2-static'.3. DISCLAIMER I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE USE OF THIS PROGRAM, HOWSOEVER CAUSED. DO NOT COMPRESS ANY DATA WITH THIS PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.* Portions of this README were copied directly from the bzip2 README written by Julian Seward. 4. PBZIP2 DATA FORMATYou should be able to compress files larger than 4GB with pbzip2.Files that are compressed with pbzip2 are broken up into pieces andeach individual piece is compressed. This is how pbzip2 runs fasteron multiple CPUs since the pieces can be compressed simultaneously.The final .bz2 file may be slightly larger than if it was compressedwith the regular bzip2 program due to this file splitting
2025-03-28Performs actions on files and directories recursively.21. tarThe tar command in Linux is used to archive files into a tar archive. Using the command options, you can also compress file size with bzip2 & gzip. While creating a tar archive using the tar command, it always keeps the original files. This command is also used to extract files from the tar archive in different ways.Syntaxtar [OPTION]... [FILE]Useful Options -c → Creates uncompressed tar archive. -x → Extracts files from the tar archive. -v → Displays archived files of the tar archive. -f → Sets the name of a tar archive. -t → Displays the list of the tar archive. -j → Creates tar archive with bzip2. -z → Creates tar archive with gzip. -r → Updates files/directories of the existing tar archive. –wildcards → Specifies patterns of archived files of a tar archive. –delete → Deletes file/directory from the tar archive.22. gzipgzip command in Linux is used to compress & decompress files. The file size is decreased without losing data using this command in Linux. This command can also be used to test the integrity of the compressed files. Like some other compression commands, it replaces the original file while compression.Syntaxgzip [OPTION]... [FILE]...Useful Options -f → Forces compression of the file & removes the original file. -k → Compresses file but does not remove the original file. -r → Compresses all files of a specified directory. -v → Displays the name & percentage of reduction of file. -d → Decompresses file that is compressed.23. gunzipThe gunzip command in Linux is used to decompress the compressed files. It is used to check the integrity of the compressed files as well as the percentage reduction of the files in Linux. This command can also be used to display the contents of the compressed files. Like some other decompression commands, it replaces the original file while decompression.Syntaxgunzip [OPTION]... [FILE]...Useful Options -k → Compresses file but does not remove the original file. -v → Displays the name & percentage of reduction of file. -l → Displays information about the compressed files. -c → Displays
2025-04-03