bzip2 command not found. Install bzip2 CentOS 7
ERROR : -bash: bzip2: command not found
I got ‘bzip2 command not found’ error on my centOS 7 server. On CentOS 7 and Redhat servers, bzip2 command is provided by bzip2 package. This package might not be installed on your Linux server.
root@server [~]# bzip2 -z file.txt
-bash: bzip2 command not found
bash: /usr/bin/bzip2: No such file or directory
How to Install bzip2 On CentOS 7 and RHEL 7 Server
1. Log into your Linux Server via SSH as root user
2. “rpm -qa | grep bzip2” command will show whether it is installed or not.
bzip2 package was not installed on my centos server.
3. You can install bzip2 package on your server using yum install command.
root@server [~]#
root@server [~]# yum install bzip2
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
bzip2 x86_64 1.0.6-13.el7 base 52 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package
Total download size: 52 k
Installed size: 82 k
Is this ok [y/d/N]: y
Downloading packages:
bzip2-1.0.6-13.el7.x86_64.rpm | 52 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : bzip2-1.0.6-13.el7.x86_64 1/1
Verifying : bzip2-1.0.6-13.el7.x86_64 1/1
Installed:
bzip2.x86_64 0:1.0.6-13.el7
Complete!
root@server [~]#
Now bzip2 is installed on the server. Now you can try compressing and decompressing files using bzip2
4. Run the following command to verify installation by checking bzip2 version
bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010.
How to download and install bzip2 rpm on CentOS 7 and Redhat 7 server
1. Log into CentOS 7 server via SSH as ‘root’ user
2. Download bzip2 rpm file from CentOS website using wget command
3. You can install the downloaded package either using yum command or rpm command.
yum command will install the required dependencies.
You must download and install the required dependency if you are installing using rpm command.
Bzip2 command usage
usage: bzip2 [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