Skip to content


Linux command line calculator

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

Posted in Centos, Debian, Fedora, Red Hat, Ubuntu.

Tagged with , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. What would happen if I tried this Linux command? | Linux Accounting linked to this post on 2009/09/25

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



Some HTML is OK

or, reply to this post via trackback.