bc is an arbitrary precision calculator language
By default the bc command installed in your system, if the bc command not found we can easily install it.
# bc
-bash: bc: command not found
Ubuntu / Debian
Use the below command to install bc in Ubuntu or Debian
# apt-get install bc
CentOS / RHEL / Fedora
# yum install bc
---> Package bc.x86_64 0:1.06.95-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================
Package Arch Version Repository Size
=====================================================================================
Installing:
bc x86_64 1.06.95-1.el6 base 110 k
Transaction Summary
======================================================================================
Install 1 Package(s)
Total download size: 110 k
Installed size: 212 k
Is this ok [y/N]: y
....
Installing : bc-1.06.95-1.el6.x86_64 1/1
Verifying : bc-1.06.95-1.el6.x86_64 1/1
Installed:
bc.x86_64 0:1.06.95-1.el6
Complete!
Once you have installed it you can use the below commands,
# bc --version
bc 1.06.95
# man bc
bc 1.06.95
# man bc
Use bc command with simple calculation:
# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
125*12/100
15
125+15
140
quit
local@host #
Comments (0)