Sep 04 2009

Linux command line calculator

Published by amjad at 3:37 pm under Centos, Debian, Fedora, Red Hat, Ubuntu

Some of the time, we are in need to do some quick calculations while on console or terminal. Here what bc, a command line calculator, comes in handy.
In this short tutorial, I will show how to do some basic calculation with bc.

First launch bc by typing bc and hitting enter. You will see bc ready to take your commands.

bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.

To add two numbers, for example 234 and 567, type them as

234+567

You will get 801 as answer.

To multiply three number, say, 234, 567 and 678, write

235*567*678

and bc will promptly display the answer 90340110.

To divide a number, 210 by 10, type

210/10

which will give the result as 21.

To quit, type quit.

quit
Share The Knowledge:
  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Diigo
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • Reddit
  • StumbleUpon
  • Twitter
  • Blogosphere News
  • Identi.ca
  • Slashdot
  • Technorati

One response so far

One Response to “Linux command line calculator”

  1. [...] Linux command distinction estimator – linuxgravity.com [...]

Leave a Reply