From Gentoo Wiki
Jump to:navigation Jump to:search

This article is a stub. Please help out by expanding it - how to get started.
This article has been flagged for not conforming to the wiki guidelines (missing lead-in sentences, empty sections). Please help Gentoo out by starting fixing things.

ledger is a scriptable double-entry accounting system for the command-line. Unlike most other accounting software, ledger eschews opaque binary file formats and embraces a simple but well structured text file as its file format of choice. The file format ledger uses has the advantage of being trivial for both computers and humans to parse. So much so that ledger single-handedly spawned the Plain Text Accounting movement. This has lead to dozens of clones and support tools that all embrace ledger's file format, the most prominent of which are hledger (Haskell) and Beancount (Python).


USE flags

USE flags for app-office/ledger Double-entry accounting system with a command-line reporting interface

debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
python Add optional support/bindings for the Python language


root #emerge --ask app-office/ledger

Environment variables

ledger has an extensive list of command-line options detailed in its man page, nearly any one of which can be turned into an environment variable. When an environment variable conflicts with a command-line option, the command-line option takes precedence.


  • ~/.ledgerrc - user specific configuration file.




How do I import a CSV file into ledger?

ledger comes with a convert command that readily accepts a CSV file as input. The only issue is that it must be told how to parse and date codes it encounters as there are several standards in use internationally:

ledger convert download.csv --input-date-format "%Y/%m/%d"

How do I convert files from Quickbooks?

This is not directly supported, but there are third party tools that will do this, such as:

How do I import files from GNUCash?

This isn't directly supported either but simple third party scripts can do this, such as:



root #emerge --ask --depclean --verbose app-office/ledger

See also

  • hledger
  • Beancount
  • bc — arbitrary-precision fixed-point mathematical scripting language
  • sc-im — a terminal-based spreadsheet and calculator with vim-like key bindings

External resources