bc command not found - Ubuntu

Page content

How to Install bc Command on Ubuntu

If you are using Ubuntu and trying to use the bc command but getting a “command not found” error, you can easily install it using the package manager.

What is the bc Command?

bc stands for “basic calculator” and is a command-line utility that provides arbitrary-precision arithmetic. It is commonly used for mathematical calculations and can handle floating-point numbers, mathematical functions, and more.

Installation on Ubuntu

To install the bc command on Ubuntu, open a terminal and run the following command:

sudo apt update
sudo apt install bc

If the bc command is not found on Ubuntu, it might be due to the package not being included in the default repositories. In such cases, you can enable the universe repository, which contains community-maintained software, including bc.

To enable the universe repository, run the following command:

sudo add-apt-repository universe

After enabling the universe repository, update the package list and install bc as mentioned above.

Conclusion

In this tutorial, you learned how to install the bc command on Ubuntu to perform mathematical calculations using arbitrary precision arithmetic. By following the steps outlined here, you can easily resolve the “command not found” error and start using bc on your Ubuntu system.