ledger -- double-entry accounting system with a command-line interface
http://wiki.github.com/jwiegley/ledger
Ledger is a powerful, double-entry accounting system that is accessed
from the UNIX command-line. This may put off some users, as there is
no flashy UI, but for those who want unparalleled reporting access to
their data, there really is no alternative.