Installing the bc Command
Now that we understand what bc
is, let us install it on our Ubuntu system.
Update Package Repository
First, we need to update the package repository to ensure we get the latest version. Open your terminal and run:
sudo apt update
You will see output similar to this:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
...
Reading package lists... Done
Install bc
Now, let us install the bc
package using the apt package manager:
sudo apt install -y bc
The -y
flag automatically answers "yes" to any prompts, making the installation process smoother.
You will see output similar to:
Reading package lists... Done
Building dependency tree... Done
...
Setting up bc (1.07.1-3build1) ...
...
Verify the Installation
After installation, verify that bc
is correctly installed by checking its version:
bc --version
You should see output similar to:
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
...
You can also check the location of the bc
executable:
which bc
This should display something like:
/usr/bin/bc
Congratulations! You have successfully installed the bc
command on your Ubuntu system.