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 [arguments]

PARAMETERS

--file FILE
    Specify the input journal file (default: ./journal or ~/.hledger.journal).

--alias ALIAS=EXP
    Define a command alias.

--amount-style STYLE
    Set the amount display style (e.g., 'commodity', 'plain').

--begin DATE
    Filter transactions starting from the specified date.

--end DATE
    Filter transactions up to the specified date.

--depth N
    Set the depth for account hierarchies.

--flat
    Produce flattened reports (no account hierarchy).

--sort FIELD
    Sort transactions by the specified field (e.g., 'date', 'amount').

--desc
    Sort in descending order.

--value EXPRESSION
    Select transactions matching a given value expression.

--account ACCOUNT
    Filter transactions by account.

--payee PAYEE
    Filter transactions by payee.

--tag TAG
    Filter transactions by tag.

bal [options] [accounts]
    Show account balances.

reg [options] [accounts]
    Show transaction registers.

cashflow [options] [accounts]
    Show cash flow.

income [options] [accounts]
    Show income statement.

print [options] [accounts]
    Print transactions.

stats [options] [accounts]
    Show statistics.

tags
    List all tags.

accounts
    List all accounts.

--help
    Display help information.

--version
    Display version information.

DESCRIPTION

hledger is a powerful command-line accounting tool designed for personal and small business finance management. It leverages plain text data files, typically in a double-entry accounting format, to track income, expenses, assets, and liabilities.
Unlike GUI-based accounting software, hledger prioritizes simplicity, flexibility, and control over your financial data. All data is stored in a human-readable and easily editable text format, allowing you to use any text editor or script to manage your finances.
Key features include transaction recording, automated balancing, customizable reports, currency conversion, and support for various plain text formats (e.g., Ledger, Hledger).
hledger excels in providing clear and concise financial reports directly from the terminal, facilitating easy scripting and integration with other tools. It's ideal for users who prefer a minimalist, efficient, and transparent approach to accounting.

CAVEATS

hledger requires a properly formatted plain text journal file. Understanding double-entry accounting principles is helpful for effective use. Error messages can sometimes be cryptic, requiring careful examination of your journal file.

INPUT FILE FORMAT

hledger typically uses the .journal file extension for its plain text accounting files. The format consists of transactions, each containing a date, optional payee, and one or more postings.
Postings specify the accounts affected and the amounts involved. hledger supports comments, tags, and automated balancing using the '=' character.

REPORTING

hledger provides a variety of reporting options including balance sheets (bal), transaction registers (reg), cash flow reports (cashflow), and income statements (income). These reports can be customized using various command-line options to filter, sort, and aggregate data.
The print command allows exporting transactions in various formats.

CONVERSION

hledger can convert different file types with the command: hledger-convert. Convert from qif, csv, gnucash and other formats is supported.

HISTORY

hledger is a reimplementation of Ledger in Haskell, aiming for improved performance and features. The project began in 2007 to provide robust command-line accounting.
It has gained popularity among users who value plain-text accounting workflows due to its speed, flexibility and active development.

SEE ALSO

ledger(1)

Copied to clipboard