Author: Joe Barr
The following description comes directly from Ledger’s home page:
Ledger is an accounting tool with the moxie to exist. It provides no bells or whistles, and returns the user to the days before user interfaces were even a twinkling in their father’s CRT. What it does offer is a double-entry accounting ledger with all the flexibility and muscle of its modern day cousins, without any of the fat. Think of it as the Bran Muffin of accounting tools.
Follow the link on the Ledger home page to grab the latest tarball. I needed to add the GMP and PCRE libraries in order to compile Ledger; your mileage may vary. Since I wanted to see how well it worked with GnuCash, I also had to specify
--enable-xml and install the requisite XML libraries when configuring.
Ledger does not include a man page, but it does come with its own internal and external docs. For help, enter
ledger -H, and prior to that, I recommend you spend some time perusing the manual, included in the tarball as ledger.pdf. For more help, subscribe to the mailing list or join the IRC #ledger channel at Freenode.
Ledger is simple. It’s nothing more than a text-based ledger with lightning-fast query and reporting capabilities. All from the CLI, thank you very much. If you believe in Emacs, you’ll celebrate the load library included in the download. Even if you’re an infidel, using the vi editor, you’re not forgotten — there is a ledger.vim file included as well. Knock yourself out.
If you’re not quite that hardcore, you can simply use whatever text editor you prefer: Gedit, for example. Or you can use no text editor at all, by keeping your books with GnuCash and using Ledger only to query and report.
The sample data included with the download gives you an idea of what the native Ledger source data looks like:
= /^Expenses:Books/ (Liabilities:Taxes) -0.10
~ Monthly Assets:Bank:Checking $500.00 Income:Salary
2004/05/01 * Checking balance Assets:Bank:Checking $1,000.00 Equity:Opening Balances
2004/05/01 * Investment balance Assets:Brokerage 50 AAPL @ $30.00 Equity:Opening Balances
2004/05/14 * Pay day Assets:Bank:Checking $500.00 Income:Salary
2004/05/27 Book Store Expenses:Books $20.00 Liabilities:MasterCard
2004/05/27 (100) Credit card company Liabilities:MasterCard $20.00 Assets:Bank:Checking
It looks easy enough, but I have to admit that after a very short while, I gave up on learning how to maintain the ledger in its native form. The call is yours, so long as you can endure the mocking tone of the documentation which describes the inanity of jointly using GnuCash and Ledger.
Enough of how to talk to Ledger — let’s see what Ledger can tell us.
Let’s start with a couple of simple balance queries against the included sample data. If we enter
ledger -f sample.dat bal, it recaps the ledger like this:
$1,480.00 50 AAPL Assets $-2,500.00 Equity $20.00 Expenses $-500.00 Income $-2.00 Liabilities -------------------- $-1,502.00 50 AAPL
If we’re only interested in the balance of our checking account, we could enter
ledger -f sample.dat balance Checking, and see this:
$1,480.00 Assets:Bank:Checking -------------------- $1,480.00
Need more detail? Try the register command instead of balance, like this one:
ledger -f sample.dat register Checking:
2004/05/01 Checking balance Assets:Bank:Checking $1,000.00 $1,000.00 2004/05/14 Pay day Assets:Bank:Checking $500.00 $1,500.00 2004/05/27 Credit card company Assets:Bank:Checking $-20.00 $1,480.00
What if you only want to know the amount of a certain transaction? In that case, you can construct a query like this, which searches the ledger for entries on a specific date and a match for “Book” as payee:
ledger -f sample.dat 2004/05/27 Book 2004/05/27 Book Store Expenses:Books $20.00 Liabilities:MasterCard $-20.00 (Liabilities:Taxes) $-2.00
While I’ve covered only the simplest aspects of Ledger here, the fact remains that Ledger can and does do real accounting, including budgets, stocks, commodities, and extensive reporting including plots and graphs. Of course, all that is dependent upon you having a solid grasp of accounting, the CLI, and the Ledger application. For some, it’s just right. One resident of the #ledger IRC channel on Freenode told me that he gave up Quicken for Ledger.
- Free Software