Command line calculators
You can do a lot of things inside a Terminal window, even use a calculator. These are some calculator programs.
Table of Contents
Bash arithmetic expansion
You can perform arithmetic calculations without any external program, just englobe the operation with a $
and double parentheses. You can also use expr
.
echo $((5+8))
expr 5 + 8
wcalc
You can run wcalc
and a mathematical expression (use single quotes when adding the expression):
$ wcalc 'log(8)'
= 0.90309
Or you can only run wcalc
and you will enter into interactive mode.
$ wcalc
Enter an expression to evaluate, q to quit, or ? for help:
>
Type wcalc P
and the number of decimals displayed for the results.
$ wcalc P20 pi
= 3.14159265358979323846
Some examples of using wcalc
:
> 2*3
= 6
> sqrt(8)
= 2.82843
> ln 5
= 1.60944
bc
bc
allows to add calculations on a file and run bc <file>
. It also has an interactive mode and it can get the operations from stdin:
$ echo "3.3+5.6"  bc
8.9
$ bc
bc 1.07.1
Copyright 19911994, 1997, 1998, 2000, 2004, 2006, 2008, 20122017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
 You can exit from this mode by typing q.
bc l
includes a math library with several basic functions included, like l(x)
for the natural logarithm of ‘x’, or s(x)
for the sine of ‘x’ (‘x’ is in radians).
bc
has some predefined variables. One of them is ‘scale’ and it means the number of decimals displayed. You can modify it by typing scale=<number>
inside bc
interactive mode.
scale=2
1/3
.33
Some examples of using bc
:
4*(3+5)
32
3^2
9
# from decimal to binary
$ echo "obase=2; 3"  bc
11
Featured content:

Useful dpkgreconfigure commands
In Debian/Ubuntu systems, you can use
dpkgreconfigure
to reconfigure an installed package using intuitive dialogs. I will show you how to use this command to change some system settings. 
Add an OCR layer to a PDF with Tesseract and ocrmypdf
If you have a scanned PDF and you want to be able to search and copy text from it, in this tutorial I will show you how to do it.

X11 forwarding with Docker containers
If you want to do X11 forwarding from your container to your host, you can type these simple commands.

Commandline web browsers
If you don’t have a Graphical User Interface (GUI) on your Linux device, or you need a simple textbased web browser, I will show you a couple of great programs.

List of Linux websites
A comprehensive list of Linuxrelated websites sorted by categories.