LinuxCommandLibrary

hledger

Record and report personal finance transactions

TLDR

Record new transactions interactively, saving to the default journal file

$ hledger add
copy

Import new transactions from bank.csv, using bank.csv.rules to convert
$ hledger import [path/to/bank.csv]
copy

Print all transactions, reading from multiple specified journal files
$ hledger print [[-f|--file]] [path/to/prices-2024.journal] [[-f|--file]] [path/to/prices-2023.journal]
copy

Show all accounts, as a hierarchy, and their types
$ hledger accounts [[-t|--tree]] --types
copy

Show asset and liability account balances, including zeros, hierarchically
$ hledger [[bs|balancesheet]] [[-E|--empty]] [[-t|--tree]] --no-elide
copy

Show monthly incomes/expenses/totals, largest first, summarised to 2 levels
$ hledger [[is|incomestatement]] [[-M|--monthly]] [[-T|--row-total]] [[-A|--average]] --sort [[-2|--depth 2]]
copy

Show the assets:bank:checking account's transactions and running balance
$ hledger [[areg|aregister]] assets:bank:checking
copy

Show the amount spent on food from the assets:cash account
$ hledger print assets:cash | hledger [[-f|--file]] - [[-I|--ignore-assertions]] aregister expenses:food
copy

SYNOPSIS

hledger [OPTIONS] [COMMAND [ARGS...]]

PARAMETERS

-h --help
    show general or command help

-V --version
    show version info

-f --file FILE
    read journal file(s) instead of ~/.hledger.journal

--rules-file FILE
    CSV rules conversion file

-a --account PAT
    include account(s) matching regex

--account-list
    list account names matching arguments

-A --alias SEARCH=REPLACE
    display/rewrite account names

-c --cost
    show amounts in default currency

-B --historical
    include historical posts in reports

-C --no-colour
    disable terminal colours

--debug [CATEGORIES]
    show debug info

-b --begin DATE
    start date for reports

-e --end DATE
    end date for reports

-p --period PERIODEXP
    report period

--today DATE
    today's date (overrides $LEDGER_TODAY)

-y --commodity
    show this commodity's amounts

--invert
    invert report amounts

--no-total
    omit totals

--real
    use real (non-virtual) values

--flat
    flatten list, show leaf accounts only

--tree
    tree format (default for balance)

--add-budget
    add missing budget goals

--budget
    show budget reports

--cumulative
    show cumulative history

--forecast PERIODEXP
    show forecasted periods

--change
    show change amounts

-n --dry-run
    simulate posting without writing

--watch
    watch for file changes

DESCRIPTION

hledger is a robust, fast, intuitive plain text accounting tool for Unix-like systems, including Linux. Inspired by Ledger, it uses simple double-entry journal files to track money, time, or commodities in personal or project finances.

You edit a plain text file with transactions like:
2023/10/01 Coffee
  Expenses:Food $5.00
  Assets:Checking -$5.00


hledger reads this data and generates reports via commands: balances, registers, income statements, balance sheets, cashflow, etc. It supports hierarchies, multiple currencies, historical prices, budgeting, forecasting, and custom reports. Global options control date ranges, accounts, amounts. Subcommands include add for interactive entry, import for CSV, stats, and more.

Key strengths: future-proof format, no database/vendor lock-in, scriptable, Haskell-based for speed/reliability. Integrates with Emacs, Vim, hledger-ui (curses UI), hledger-web (web UI). Ideal for developers, power users seeking privacy/control. Community-driven, actively maintained. Limitations: steep learning curve for beginners; text-only CLI core.

CAVEATS

Requires a journal file; steep learning curve for double-entry. No built-in GUI (use hledger-ui/web). Sensitive to file encoding/permissions. Date formats flexible but must be parseable. Large files performant but complex queries slower without indexes.

COMMON SUBCOMMANDS

balance: show account balances.
register: list postings.
print: print transactions.
add: interactive entry.
import: import CSV.
bs: balance sheet.
cf: cashflow.
is: income statement.
stats: file statistics.

JOURNAL FILE

Default: ~/.hledger.journal. Supports ; comments, !include directives, commodities, tags, payees.

HISTORY

Created in 2007 by Simon Michael as a Haskell reimplementation of John Wiegley's C++ Ledger. Evolved into feature-complete alternative by 2010s, with hledger 1.0 in 2019. Actively maintained on GitHub; version 1.33+ in 2024. Gained popularity for Haskell ecosystem, portability, and extensibility.

SEE ALSO

ledger(1), beancount(1)

Copied to clipboard