Multiplication on command line terminal
Yes, you can use bash's built-in Arithmetic Expansion $(( ))
to do some simple maths
$ echo "$((5 * 5))"
25
Check the Shell Arithmetic section in the Bash Reference Manual for a complete list of operators.
For sake of completeness, as other pointed out, if you need arbitrary precision, bc
or dc
would be better.
For more advanced and precise math consider using bc(1).
echo "3 * 2.19" | bc -l
6.57
Internal Methods
Bash supports arithmetic expansion with $(( expression ))
. For example:
$ echo $(( 5 * 5 ))
25
External Methods
A number of utilities provide arithmetic, including bc and expr.
$ echo '5 * 5' | /usr/bin/bc
25
$ /usr/bin/expr 5 \* 5
25