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 [GLOBAL_OPTIONS] [COMMAND_OPTIONS] [ARGUMENTS]

Examples of common commands:
hledger [GLOBAL_OPTIONS] balance [ACCOUNT_REGEX...]
hledger [GLOBAL_OPTIONS] register [ACCOUNT_REGEX...]
hledger [GLOBAL_OPTIONS] add [ACCOUNT_REGEX...]

PARAMETERS

--file FILE, -f FILE
    Path to the journal file to use.

--output-format FORMAT, -o FORMAT
    Specifies the output format (e.g., csv, json, html, text).

--start DATE, -b DATE
    Includes transactions on or after the specified date.

--end DATE, -e DATE
    Includes transactions on or before the specified date.

--period PERIOD, -p PERIOD
    Filters data for a specific period (e.g., "last month", "2023").

--depth N
    Limits the display depth of accounts in hierarchical reports.

--query QUERY
    Filters transactions or posts using a search query (e.g., "food and (date:2023/01/01..2023/01/31)").

--cost
    Displays amounts using their original cost.

--value
    Displays amounts using their current market value.

DESCRIPTION

hledger is a powerful, cross-platform command-line utility for double-entry accounting. It manages financial data stored in plain text files (often .journal or .hledger files). Inspired by the original Ledger command, hledger brings its own set of features and a Haskell implementation, focusing on reliability and a consistent user experience. It allows users to track income, expenses, assets, and liabilities by entering transactions in a human-readable format. hledger can generate various financial reports, including balance sheets, income statements, registers, and more, directly from the command line. Its plain text format makes it highly flexible, version-controllable (e.g., with Git), and future-proof, avoiding vendor lock-in typical of proprietary accounting software. It supports advanced features like recurring transactions, commodities, budgeting, and multiple currencies, making it suitable for both personal and small business finance management.

CAVEATS

  • Learning Curve: Requires understanding of double-entry accounting and its specific plain-text file format.
  • Text-based: No GUI by default; interaction is purely through the command line.
  • Strict Syntax: The journal file syntax is precise; minor errors can lead to unexpected results.
  • Data Integrity: User is responsible for backing up journal files.

PLAIN TEXT DATA

Financial data is stored in simple, human-readable text files, making it highly flexible, portable, and easily integrable with version control systems like Git for tracking changes.

EXTENSIBILITY

Being a command-line tool, hledger can be easily scripted and integrated into custom workflows, allowing for automation of reporting or data input.

MULTI-CURRENCY SUPPORT

Handles transactions and reports across multiple currencies with automated price fetching capabilities.

HISTORY

hledger emerged as a reimplementation of the popular Ledger CLI accounting system, written in Haskell. Its development began in 2008, aiming to provide a robust, reliable, and easily maintainable alternative to Ledger's C++ codebase. While inspired by Ledger's concepts and command-line interface, hledger has evolved with its own distinct features, a slightly different syntax interpretation, and a strong focus on correctness and user-friendliness inherent to the Haskell language. It has gained a dedicated community and is actively maintained, becoming a significant tool in the plain text accounting ecosystem.

SEE ALSO

ledger(1), beancount(1), git(1)

Copied to clipboard