How to Use the Linux Terminal as a Calculator – pcinfo

Do you prefer the simplicity of a Linux terminal through a nice GUI? If you need to do math quickly, you do not need to use the calculator app. You can use the terminal to perform calculations using the tools you have already installed.

Try using a Linux terminal as a calculator, regardless of your distribution.

Calculations using GNU bc

The bc element of GNU bc stands for "Basic calculator". The bc program itself was Unix-based in the 1970s. GNU bc is a more modern and improved version and should already be found on a Linux system.

If you do not have GNU bc, use the package manager that the distribution uses. The package is simply bc . To get started, open Terminal, type bc and press Enter.

  Linux Terminal Calculator Gnubc

The plus, minus, slash, and asterisk symbols are used in calculations. Exit and exit and exit the program. The first two (+ and -) are straight lines, the slashes are used for division, and the asterisks are used for multiplication.

You can also use brackets, variables, arrays, algebraic expressions, and so on. Please refer to the GNU bc manual.

Calculated as Calc

An alternative to bc is another terminal-based tool calc . Like BC, it is another old Unix tool that has found ongoing support for Linux. The installation package is called apcalc on Ubuntu and Debian based systems, but calc can be found elsewhere.

To open calc type calc . Press Terminal and press Enter. As with BC, you should use the typical operators.

  Linux Terminal Calc Calc

Press Enter when entering the calculation. 5 * 5 The answer appears directly below. Type quit and press Enter.

Using terminal commands directly (Echo and Expr)

No additional programs or packages are required to perform basic math calculations in the following ways: Linux terminal. With the generic bash shell, you can perform basic calculations directly using echo . For example, if you plan to use math as part of your bash script, you can do this.

The expr supplied with coreutils is available on almost all Linux and Unix based systems. Expr can be used in bash scripts like echo.

echo echo $ ((2 * 2)) 2 * 2 terminal.

  Linux Terminal Calculator Echo

To use expr, type expr and calculate it. There is no trigonometric method here because you can only do simple math calculations.

For example, expr 33 * 2 multiplies 33 by 2. A backslash before an asterisk is required for multiplication for other operators, but not for other operators.

  Linux terminal calculator Expr

If you want to perform basic mathematical calculations, you can use echo and expr. If you need something more advanced, choose another method listed here.

Calculated as Qalc

Qalc is a necessary tool if you need items that require some additional functionality, such as currency conversion. It is the end cousin of Qalculate, a cross platform calculator with GUI.

Use the Distribution Package Manager to install the qalc package. Enter qalc in the terminal and press the Enter key to start.

  Linux Terminal Calculator Qalc

The most comprehensive and familiar terminal calculator app for Linux users.

To perform currency conversion, you must start qalc and then enter ex to update the exchange.

Pi on Easy

Mathematics is not the easiest to master, but it can solve the hassle of fast Linux mathematical calculations using terminals. In addition to general software such as GNU bc, tools such as echo and expr can be used to calculate numbers easily, quickly, and quickly.

Which Linux calculation tool is the easiest and favorite tool? Please let us know in the comment below.

Is this article useful?

Please Note: This content is provided and hosted by a 3rd party server. Sometimes these servers may include advertisements. igetintopc.com does not host or upload this material and is not responsible for the content.