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.
Anyone know of such a beast?
- -- Reg.Clemens reg@dwf.com
Around 06:46pm on Tuesday, June 01, 2004 (UK time), clemens@dwf.com scrawled:
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.
Anyone know of such a beast?
Accessories -> Scientific Calculator?
On Tue, 01 Jun 2004 11:46:21 -0600, clemens@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.
If it's just an application you want, as opposed to getting it returned on the command line, then you can use something like KCalc[1] or the Gnome alternative.
[1] You might have to select "logic buttons" under the settings menu.
clemens@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.
Anyone know of such a beast?
In gnome, click on the Fedora Button => Accessories => Calculator. In the calculator, click on "View" and select 'Scientific Mode'. From a command line, type 'gcalctool'.
On Tue, 2004-06-01 at 12:58 -0500, Randy Kelsoe wrote:
clemens@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.
Anyone know of such a beast?
In gnome, click on the Fedora Button => Accessories => Calculator. In the calculator, click on "View" and select 'Scientific Mode'. From a command line, type 'gcalctool'.
or a better command line answer is bc:
Number of seconds since 00:00:00 1970-01-01 UTC in 1) octal: echo "obase=8;$(date +%s)" | bc -l 2) decimal: echo "obase=10;$(date +%s)" | bc -l 3) hex: echo "obase=16;$(date +%s)" | bc -l
On Tue, 2004-06-01 at 13:58, Randy Kelsoe wrote:
clemens@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.
Anyone know of such a beast?
In gnome, click on the Fedora Button => Accessories => Calculator. In the calculator, click on "View" and select 'Scientific Mode'. From a command line, type 'gcalctool'.
How about the bc command. If you run it in interactive mode you can then specify the base using the command ibase=16 (for hex) then any numbers you enter will be converted.
On Tue, Jun 01, 2004 at 12:58:26PM -0500, Randy Kelsoe wrote:
clemens@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.
Anyone know of such a beast?
In gnome, click on the Fedora Button => Accessories => Calculator. In the calculator, click on "View" and select 'Scientific Mode'. From a command line, type 'gcalctool'.
Or if you (like me) are a more traditional unix user, you can use the commandline calculator "bc":
# 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'. obase=16 256 100 obase=A 256 256 obase=8 256 400 quit
# 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'. ibase=16 100 256 ibase=8 256 174 quit
On Tue, Jun 01, 2004 at 11:46:21AM -0600, clemens@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