Is there a tool to convert decimal/octal/hex ?

Romain Kang romain at kzsu.stanford.edu
Tue Jun 1 17:58:28 UTC 2004


On Tue, Jun 01, 2004 at 11:46:21AM -0600, clemens at dwf.com wrote:
> I seem to remember that there used to be a tool in Linux to
> convert between decimal and octal and Hex, but I havent 
> stumbled over it in my recent search.

There are plenty of open source programs like "hexcalc" which you
can run on X displays, or desktop accessories for Gnome or KDE.
Follow your menu bar...

However, the old school way is to use "dc", the UNIX "desktop
calculator".  It uses Reverse Polish Notation, so some prefer "bc"
instead (which historically was just a front end to dc).  These are
probably on almost every variant of UNIX out there.

Example:

sprite;~[102]> dc
33 16 o p
21
16 i A o FFFF343 p
268432195

Remember, the UNIX folks of 30 years ago had 10 cps teletypes, so
terseness was a great virtue.  The same in bc:

sprite;~[103]> bc
obase=16
33
21
ibase=16
obase=A
FFFF343
268432195

Note that hex numbers require capital A-F, since the lowercase
versions denote some internal operations in bc.

Romain





More information about the fedora-list mailing list