bc command not found - Amazon Linux

Page content

How to Install bc Command on Amazon Linux

If you are using Amazon Linux and find that the bc command is not available, don’t worry. bc is a command-line calculator that allows you to perform mathematical calculations.

Why is bc Command Not Available?

In some distributions, including Amazon Linux, the bc package is not installed by default. This is why you may encounter the “command not found” error when trying to use bc.

Installation Steps

To install the bc command on Amazon Linux, you can use the following steps:

  1. Update the package repository:
sudo yum update
  1. Install the bc package:
sudo yum install bc
  1. Once the installation is complete, you can use the bc command to perform calculations in the terminal.

Compatibility Note

If you encounter the “yum command not found” error, it means that the package manager yum is not available on your system. Amazon Linux 2, which is the newer version, uses yum as the package manager, while Amazon Linux 1 uses yum or rpm.

For Amazon Linux 2, you can use the following commands instead:

  • Update the package repository:
sudo yum update
  • Install the bc package:
sudo yum install bc

By following these steps, you can successfully install and use the bc command on Amazon Linux.

Conclusion

In this tutorial, we covered how to install the bc command on Amazon Linux, explained why it might not be available by default, and provided solutions for compatibility issues. Now you can enjoy using the bc command for your mathematical calculations on Amazon Linux.