rpn
is a simple, CLI
RPN calculator for
Linux. rpn
was written in Go and is statically compiled, requiring no external
libraries. Installation is as simple as running one command and should work on
any Linux distribution.
This is a work in progress, but rpn
already supports a number of operations and
should be useful for daily work.
I've been using RPN calculators for a long time and the lack of a simple and
convenient CLI version (think bc
, but using RPN) frustrated me. I've used
dc
many times, but it has some quirks that quickly stand in the way of
productivity, like having to print the results of the stack every single time,
no editing in the command-line, etc.
Looking around the Debian repos and Github revealed some possible alternatives, but they also come with their own set of inconveniences, like:
- Requiring a GUI.
- Requiring the installation of many dependencies (npm, Java runtime, etc).
- Not allowing editing of the command-line, or recall of a previous line.
- Using a TUI (and making editing more complicated).
- Buggy or incomplete implementations.
- Too complex.
The idea of rpn
is to be simple and functional enough to be your daily driver
RPN calculator. :)
To download and install automatically (under /usr/local/bin
), just run:
curl -s \
'https://raw.githubusercontent.com/marcopaganini/rpn/master/install.sh' |
sudo sh -s -- marcopaganini/rpn
This assumes you have root equivalence using sudo
and will possibly require you
to enter your password.
To download and install under another directory (for example, $HOME/.local/bin
), run:
curl -s \
'https://raw.githubusercontent.com/marcopaganini/rpn/master/install.sh' |
sh -s -- marcopaganini/rpn "$HOME/.local/bin"
Note that sudo
is not required on the second command as the installation directory
is under your home. Whatever location you choose, make sure your PATH environment
variable contains that location.
Just navigate to the releases page and download the desired
version. Unpack the tar file into /usr/local/bin
and run a chmod 755 /usr/local/bin/rpn
. If typing rpn
doesn't work after that, make sure
/usr/local/bin
is in your PATH. In some distros you may need to create
/usr/local/bin
first.
If you have go installed, just run:
go install github.com/marcopaganini/rpn@latest
There are many other calculators for Linux, and some of them supporting RPN. This is a list of a few that support RPN:
- dc: The
venerable
dc
calculator. One of the oldest Unix programs. Readily available in most distributions. - dcim: An improved version of
dc
. - orpie: A Curses-based RPN calculator (TUI).
- qalculate: A very complete calculator with CLI, GTK, and QT versions. Focus is mostly on the UI part. The author doesn't seem to use RPN so the RPN mode is a bit rough around the edges.
Feel free to open issues, send ideas and PRs.