How to install bunzip2 on ubuntu or debian linux

How to Install bunzip2 on Ubuntu or Debian Linux

In this article, we will see how to install bunzip2 on Ubuntu or Debian Linux. bunzip2 is a free and open source command line tool to decompress files compressed using the bzip2(.bz2) compression format. Since it is shipped with bzip2 package, to install this tool you have to install bzip2 package. Well the good news is that this package can be easily installed in almost all the famous platforms such as Windows, Linux and macOS. Here we will see steps to install bunzip2 on Ubuntu or Debian based linux systems.

 

How to install bunzip2 on ubuntu or debian linux

Sponsored
How to Install bunzip2 on Ubuntu or Debian Linux

Also Read: How to Install Restic backup tool on Ubuntu/Debian Linux

Step 1: Prerequisites

a) You should have a running Ubuntu or Debian Linux System. In this article, we are using Ubuntu 22.04 LTS system to showcase the installation and usage of bunzip2 utility. You might be using some different Ubuntu or Debian linux system.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility available in your Server.

See also  Ubuntu Weekly Newsletter Issue 796

d) Minimum hardware requirements:-

  • CPU: Any modern processor supported by Ubuntu and Debian Linux system would be enough.
  • Memory: Although 512MB would be enough but I would recommend to use atleast 1GB of memory for better performance.
  • Storage: The bzip2 package requires only 1MB of space but it also depends on size of compressed .bz2 file and extracted output.

 

Step 2: Update Your Server

Before installing any new package, it is always recommended to check and install all the latest available features and fixes using sudo apt update && sudo apt upgrade command as shown below. This will keep your system stable and secure.

Ubuntu-Server@ubuntu:~$ sudo apt update && sudo apt upgrade

 

Sponsored

Step 3: Install bunzip2

In the next step, you can install bzip2 package from default Ubuntu repo by using sudo apt install bzip2 command as shown below. This will download and install the package along with all its dependencies.

Ubuntu-Server@ubuntu:~$ sudo apt install bzip2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
fakeroot g++ g++-11 gcc gcc-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan6 libcc1-0 libdpkg-perl libfakeroot
libfile-fcntllock-perl libgcc-11-dev libitm1 liblsan0 libquadmath0 libstdc++-11-dev libtsan0 libubsan1 lto-disabled-list
Use 'sudo apt autoremove' to remove them.
Suggested packages:
bzip2-doc
The following NEW packages will be installed:
bzip2
0 upgraded, 1 newly installed, 0 to remove and 62 not upgraded.
Need to get 34.8 kB of archives.
After this operation, 117 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 bzip2 amd64 1.0.8-5build1 [34.8 kB]
Fetched 34.8 kB in 1s (67.3 kB/s)
Selecting previously unselected package bzip2.
(Reading database ... 241309 files and directories currently installed.)
Preparing to unpack .../bzip2_1.0.8-5build1_amd64.deb ...
Unpacking bzip2 (1.0.8-5build1) ...
Setting up bzip2 (1.0.8-5build1) ...
Processing triggers for man-db (2.10.2-1) ...

 

See also  20 years of partnership: how our partners help us take Ubuntu across industries, markets and devices

Step 4: Check Version

After successful installation, you can check current installed version by using bunzip2 --version command as shown below.

Ubuntu-Server@ubuntu:~$ bunzip2 --version
bzip2, a block-sorting file compressor. Version 1.0.8, 13-Jul-2019.

Copyright (C) 1996-2019 by Julian Seward.

This program is free software; you can redistribute it and/or modify
it under the terms set out in the LICENSE file, which is included
in the bzip2 source distribution.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
LICENSE file for more details.

 

Step 5: Uncompress .bz2 file

Now that bunzip2 is installed, it is time to test this utility. We have an example bzip2 file called restic.bz2 which can be decompressed using bunzip2 restic.bz2 command as shown below. You will see that the extracted file will replace the original downloaded bzip2(.bz2) file.

Ubuntu-Server@ubuntu:~$ bunzip2 restic.bz2

If you are looking to retain the original bzip2 file along with the extracted file then you have to use -k option during decompression.

Ubuntu-Server@ubuntu:~$ bunzip2 -k restic.bz2

 

Step 6: Check all available options

You can check all options available with bunzip2 utility using bunzip2 --help command as shown below.

Ubuntu-Server@ubuntu:~$ bunzip2 --help
bzip2, a block-sorting file compressor. Version 1.0.8, 13-Jul-2019.

   usage: bunzip2 [flags and input files in any order]

  -h --help           print this message
  -d --decompress     force decompression
  -z --compress       force compression
  -k --keep           keep (don't delete) input files
  -f --force          overwrite existing output files
  -t --test           test compressed file integrity
  -c --stdout         output to standard out
  -q --quiet          suppress noncritical error messages
  -v --verbose        be verbose (a 2nd -v gives more)
  -L --license        display software version & license
  -V --version        display software version & license
  -s --small          use less memory (at most 2500k)
  -1 .. -9            set block size to 100k .. 900k
  --fast              alias for -1
  --best              alias for -9

If invoked as `bzip2', default action is to compress.
as `bunzip2', default action is to decompress.
as `bzcat', default action is to decompress to stdout.

If no file names are given, bzip2 compresses or decompresses
from standard input to standard output. You can combine
short flags, so `-v -4' means the same as -v4 or -4v, &c.

 

See also  How to Install Google Cloud BigQuery Python client library on Linux

Step 7: Uninstall bunzip2

Once you are done using bunzip2 utility, you can choose to remove it from your system by using sudo apt remove bzip2 command as shown below. To remove all dependencies installed with bzip2 package, use --auto-remove option with below command.

Ubuntu-Server@ubuntu:~$ sudo apt remove bzip2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
fakeroot g++ g++-11 gcc gcc-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan6 libcc1-0 libdpkg-perl libfakeroot
libfile-fcntllock-perl libgcc-11-dev libitm1 liblsan0 libquadmath0 libstdc++-11-dev libtsan0 libubsan1 lto-disabled-list
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
build-essential bzip2 dpkg-dev file-roller gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal
0 upgraded, 0 newly installed, 7 to remove and 62 not upgraded.
After this operation, 5,080 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 242089 files and directories currently installed.)
Removing build-essential (12.9ubuntu3) ...
Removing dpkg-dev (1.21.1ubuntu2.3) ...
Removing ubuntu-desktop (1.481.1) ...
Removing ubuntu-desktop-minimal (1.481.1) ...
Removing gnome-shell-extension-desktop-icons-ng (43-2ubuntu1) ...
Removing file-roller (3.42.0-1) ...
Removing bzip2 (1.0.8-5build1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libglib2.0-0:amd64 (2.72.4-0ubuntu2.4) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply