bc
Quick Reference
Command Name:
bc
Category:
calculator
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Mathematical calculations
Perform complex mathematical operations
- 2
Script calculations
Integrate mathematical operations into shell scripts
- 3
Financial calculations
Perform precise financial and accounting calculations
- 4
Scientific computing
Handle scientific calculations with high precision
Syntax
bc [options] [file...] bc -l [file...]
Options
Option | Description |
---|---|
-h, --help | Print a usage message and exit |
-i, --interactive | Force interactive mode |
-l, --mathlib | Define the standard math library |
-q, --quiet | Don't print initial welcome banner |
-s, --standard | Process exactly the POSIX bc language |
-w, --warn | Give warnings for extensions to POSIX bc |
-v, --version | Print version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the bc
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
bc
echo "5 + 3" | bc
echo "scale=4; 10/3" | bc
echo "2^10" | bc
bc -l