Linux provides several methods for calculating expressions using the command line.
bc — basic calculator for command line
bc is a native Linux tool (originated on Unix systems in 1975) that stands for “basic calculator”. To use it, simply type
bc followed by an expression. To quit, type
Additionally, variables, arrays, algebraic expressions, etc. can be used. Refer to the
bc manual for more information.
expr command evaluates basic expressions.
Keep in mind, it should be used for basic calculations. If something more advanced is required (like parenthesis),
bc or arithmetic expansion may be more suitable.
Using arithmetic expansion
Arithmetic expansion evaluates an expression and substitutes the result. In combination with
echo, it can be used as a calculator.
Qalc is a multi-purpose cross-platform desktop calculator. It provides versatility and supports many everyday needs: currency conversion, percent calculation, etc.
Install it on Ubuntu via