Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How to record journal entries

There are many ways to create hledger journal entries. Here are some options:

Interactively

With a text UI

With a web UI

On a phone or tablet

In a text editor

From scratch

  • Write the entry in full, using journal format.
  • As above, but also use editor addons to assist (like Emacs ledger-mode’s TAB account completion and M-q alignment).

From templates

  • In Emacs with yasnippet configured (eg), enter the name of a snippet and complete with TAB

From past entries

  • Find, copy and modify a past entry in the journal
  • Or in Emacs ledger-mode, enter a date and partial description and complete with C-c TAB

From future entries

  • Move the entry from a separate file where you prepared it ahead of time (eg future.journal)

At the command line

From scratch

  • Write the entry using journal format, eg
    $ cat >>$LEDGER_FILE
    2023-01-01
        expenses:food   $10
        assets:cash
    
    <CTRL-D>
    
    or
    printf >>$LEDGER_FILE '2023-01-01\n  expenses:food  $10\n  assets:cash\n\n'
    

From past entries

From periodic transaction / auto posting rules

From custom scripts

  • If you have custom scripts to help with tasks, make them print or append journal entries when appropriate. Eg have your invoicing script add an invoice transaction to the journal.

By converting data

From bank CSV (or other character-separated values)

From timeclock, timedot or other journal files

  • Just read them directly with -f
  • Or, hledger import them to main journal

From other apps or data formats

How to figure out unfamiliar entries

When you’re facing an unfamiliar bookkeeping situation where the journal entries aren’t clear, try this:

  1. Write down the real world events to be modelled, in detail

  2. Write down the things you want to know

  3. Start with a simpler version of the scenario if necessary. If you get stuck below, return here and simplify more.

  4. Discover which accounts and transactions are needed to model the situation in the most principled and correct way. Take one event at a time, and try to write the journal entry for it, using hledger to check that each transaction is balanced and the account balances make sense. If needed, return to step 3. Or consult books or the internet for ideas - but carefully, since their terminology and examples will often be different and confusing.

  5. Experiment and discover reporting commands that show the things you want to know. If it seems not possible, you may need to revisit steps 3 or 4.

  6. Now consider, are there simpler accounts/transactions/reports that might be more convenient, yet still good enough ?

  7. Choose one approach. Document it if necessary so you’ll remember. Save or automate the reporting commands so you’ll remember those.

  8. Put it into practice and refine over time to improve clarity and usability.