Almost all modern day Linux distros come with a calculator application by default, unless you use Gentoo, Arch or a similar distro. Most times such GUI based calculator are sufficient to do some quick calculations. However you may not have access to a GUI based system all the time, and you would want to use a command line based calculator utility.
There are several good command line utilities that you can use, most of it might need to be installed first as they may not be installed by default. We will take a look at some of the popular command line calculators that will serve almost all purposes.
The GNU bc is probably the most well known of the command line calculator utilities. It has been around for quite a while, and is installed by default on many distros. bc is not a calculator in a traditional sense, but can be used for such purposes. bc is actually a language with similarities to the C programming language syntax and supports arbitrary precision numbers and interactive execution of statements.
You start the calculator by simply typing bc at the command prompt. Once you have started the utility, you can type any mathematical expression using the console. It is a very powerful utility that supports variables, multiple numeric bases and built-in mathematical functions. The following is just a simple example
You can either type quit or use the keyboard shortcut Ctrl-D to exit the app. If you don’t want to use bc interactively, then you have the option of piping the expression to the bc command.
$ echo "(12+340*5)/5" | bc
Wcalc is another scientific calculator with a lot of functionalities. Although it might be a overkill to use for simple arithmetic, it is very much capable of doing much more. It supports many of the standard functions such as sine, cos, tan etc, scientific constants such as pi, e etc, and unit conversions. As with bc it has support for variables and numeric bases.
It is very unlikely that you will have this installed by default on your distro, so you will need to install it first before using it.
You can use wcalc interactively just as with bc. Type wcalc at the command prompt to get started. You can type quit or use Ctrl-D to exit the application.
For what it is worth, it supports almost all scientific constants (eg. Faraday, Atomic mass, Muon Mass, Planck’s constant, Euler’s constant etc etc) and has support for random number generators.
Another popular utility is simple called calc. It is a simple command-line utility written in Go language. This probably does not have a lot of fancy features that some of the other utilities have but is quite capable of almost all everyday operations.
It supports most of the basic scientific functions and constants out of the box, and can be used both in shell mode and in command mode.
$ calc 1 + 2
Qalculate! is actually a Qt based calculator that provides both a GUI based application as well as a command line utility. The command line utility can be invoked by just typing qalc at the command prompt. This is a scientific calculator along the lines of wcalc, but does not support as many functions, constants or features. However, it is pretty handy with expressions and conversions in addition to most mathematical calculations.
As with most of the command line calculators, you can use qalc both in the shell or command line mode.
$ qalc 1 + 2 + 334
All of the above applications of a lot of functions and advanced features that I have not enumerated in this post. You would want to check the documentation of the application if your requirements are met before installing them.
I doubt you will need anything more than the applications that I have mentioned above. There are several more of them that are probably worth trying out, but the above four should suffice for almost all of your calculations.