How To Use Calculator In Linux Command Line?


Short Bytes: You can use the Linux terminal to do mathematical calculations using command line calculator utilities. This includes the inbuilt gcalccmd and GNU bc. Qalculator, a third party utility is also a good command line calculator.

The calculator is a hell lot of a handy app because it’s hard for us to get our brains at work. Some calculator apps are intelligent, and some of them are dumb af. However, that’s a different topic of discussion we can have some other day. This article describes some tools which allow you to use the calculator from the command line in Linux distros.


It is the console version of Gnome Calculator utility present in Linux distributions like Ubuntu. To use the gcalccmd calculator tool, type the following command in the terminal:


Do the calculations

Performing calculations is simple. Just enter the numbers and desired operators in the terminal and press Enter. You can also use brackets in your calculations.


You can find the square root, natural log, etc:


You can also find sine, cosine, tangent values for given angles:


Press CTRL+D to exit from the gcalccmd tool and still remain on the command line. You can access the help section by using the help command inside gcalccmd.


Qalc is the terminal version of the calculator app, Qalculate. It doesn’t come pre-installed like gcalccmd. The command line calculator also allows you to do currency conversions besides regular calculation work.

You can install Qalc using the following command in the terminal:

sudo apt-get install qalc

After installation, if it fails to update currency exchange rates, then you can do so by following the steps below:

In the terminal, type qalc and press enter. To update the currency exchange rates, type exrates and press enter.

You can use the qalc command to start Qalculate on the command line. You can do the currency conversion as follows:


You can do unit conversion along with regular calculation stuff. Also, it remembers the answer from your last calculation. So, you can go like this:


Press CTRL+D to exit qalc command line calculator utility. You can access the help section by using the help command inside the qalc utility.

GNU bc

GNU bc is a command line calculator utility that is used for regular as well as scientific calculations in the command line.

How to install GNU bc?

Just like gcalccmd, bc is also present in your Linux distro.

Using bc

You can do calculations similar to the other command line calculators mentioned above.

These were some of the command line calculator utilities you can use on the Linux terminal. To know more about these utilities, you can visit their man pages.

If you have something to add, tell us in the comments below.

Also Read: How To Test Internet Speed Using Linux Command Line?

Aditya Tiwari

Aditya Tiwari

Aditya likes to cover topics related to Microsoft, Windows 10, Apple Watch, and interesting gadgets. But when he is not working, you can find him binge-watching random videos on YouTube (after he has wasted an hour on Netflix trying to find a good show). Reach out at [email protected]
More From Fossbytes

Latest On Fossbytes

Find your dream job