Query language
Every report command (bal, reg, is, bs, cf, budget, accounts, payees) takes zero or more query
terms. Terms are ANDed. A term applies to each posting (with its transaction as context); a posting is
reported only if every term matches.
Each shell argument is one term; an argument is also split shell-style, so both of these work:
ledgerline bal Expenses date:2026-03 not:Rent
ledgerline bal "Expenses date:2026-03 not:Rent"
ledgerline reg "payee:'Grocery store'" # quote values that contain spaces
| Term | Matches |
|---|---|
REGEX or acct:REGEX |
the posting's account (case-insensitive, re.search, so ^Assets anchors) |
payee:REGEX |
the transaction payee (part before \|) |
desc:REGEX |
the whole description |
code:REGEX |
the transaction code |
tag:NAME |
a tag named NAME on the posting or its transaction (NAME is a regex that must match the whole name) |
tag:NAME=REGEX |
tag NAME whose value matches REGEX |
amt:>1000, amt:<=-50, amt:=12.5, amt:12.5 |
the posting's signed quantity (>=, <=, >, <, =) |
cur:REGEX |
the posting's commodity |
status:*, status:!, status: |
cleared, pending, unmarked |
date:2026, date:2026-03, date:2026-03-15 |
the posting date (posting date: tag if present, else the transaction date) falls in that year/month/day |
date:2026-01..2026-03, date:2026-02.., date:..2026-06 |
a range; both ends are periods, so ..2026-03 includes all of March |
not:TERM |
negation of any term above, e.g. not:Expenses:Rent, not:payee:Uber, not:status:* |
A term whose text before the first : is not one of the keys above is an account regex, so
Expenses:Food just works.
Invalid regexes, numbers or dates are usage errors (exit status 2) that name the offending term.
Dates on the command line
-b/--begin and -e/--end accept YYYY, YYYY-MM or YYYY-MM-DD. The begin date is inclusive and the end date
is exclusive and means the start of the period you name: -b 2026-04 -e 2026-07 is April through June.
The balance sheet ignores -b (balances always accumulate from the beginning of the journal) but honours -e.
Examples
ledgerline bal Expenses:Food --monthly # monthly food spending
ledgerline reg tag:trip=goa # every posting of the Goa trip
ledgerline bal 'amt:>10000' Expenses # only postings above 10,000
ledgerline reg Assets:Bank date:2026-03 not:payee:SIP # March bank activity without SIPs
ledgerline payees status:! # payees of pending transactions