*nix command line tips

One thing which is definitively amazing with *nix OS is that you always learn new things… Let have a look at these commands:

  • bc : a nice command-line calculator… To my mind, I’ve always considered that GUI calculator are boring to use (left clic on each number to calculate)… GNU bc provides a calculator that allows you to type in expressions for immediate calculation. It uses the standard conventions for computer arithmetic, i.e. + and – are addition and subtraction, * and / are multiplication and division, ^ is exponentiation. Juts type bc in a terminal and use it as follows:
    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’.
    Parentheses can be use to set the order of evaluation (as usual)
    But, as you may have noticed, this result is “wrong”… Just because the number of digit is set to 0 by default (i.e. precision). You can change it by using the special scale variable:
    Depending your arithmetic computation, be careful with the precision scale with some arithmetic operation (for instance, exponentiation). Finally, you can type quit to leave bc. You can do a lot of thing with bc, don’t forget to read the man page (as bc is a kind of interactive programming language), just type man bc from the command line.
  • leave : a terminal reminder… Have to leave at 15H pm ? Need to rest in 1H ? Use the leave command ! Simply type leave 1500 or leave +0100, respectively… Keep in mind that leave will continue to remind you (to leave) since you close your terminal !

Submit a Comment

Spam Protection by WP-SpamFree