echo 'sqrt(144)' | bc -l

Category: Data Science & Analysis

echo 'sqrt(144)' | bc -l

Compute a square root with bc

With the -l math library loaded, bc gains functions like sqrt, sine, and logarithms. The expression sqrt(144) prints 12. Use scale to control decimal precision of the result. This is a quick way to do scientific calculations in the shell without starting Python.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.