LinuxCommandLibrary

ledger

Track financial transactions and generate reports

TLDR

Print a balance report showing totals

$ ledger balance --file [path/to/ledger.journal]
copy

List all postings in Expenses ordered by amount
$ ledger register [expenses] --sorted [amount]
copy

Print total Expenses other than Drinks and Food
$ ledger balance [Expenses] and not ([Drinks] or [Food])
copy

Print a budget report
$ ledger budget
copy

Print summary information about all the postings
$ ledger stats
copy

SYNOPSIS

ledger [options] [filename]

PARAMETERS

-f
    Specifies the journal file to read from. Defaults to $LEDGER_FILE or 'ledger' if neither is set and the file exists.

-n
    Avoid automatically inferring the currency in reports.

-V
    Print program version.

-h
    Display help message.

bal [account]
    Display account balances. Optionally, specify a particular account or accounts to display.

reg [account]
    Display a register of transactions, filtered by account.

--flat
    Disable account hierarchy.

-d
    Sets the end-date of a period query to .

-b
    Sets the begin-date of a period query to .

-e
    Selects only transactions which, when evaluated as a scheme expression, are true.

-p
    Restricts the reporting of values to the specified period, according to the period expression .

--amount-data
    Output report in a format suitable for import into a spreadsheet program.

DESCRIPTION

Ledger is a powerful, plain text accounting tool that allows users to track their finances using a double-entry accounting system. It operates from a simple text file format, promoting transparency and control over financial data.

Unlike spreadsheet-based solutions, Ledger offers advanced reporting features, enabling users to generate custom reports, track budgets, reconcile accounts, and analyze financial trends over time. It supports multiple currencies, hierarchical account structures, and various transaction types. The command-line interface allows for efficient data entry and reporting, making it a favorite among technically inclined users who value precision and flexibility in their financial management. Its plain text format also enables integration with other command-line tools for automated data processing and reporting.

Ledger is designed for both personal finance tracking and business accounting needs. It requires some knowledge of accounting principles to be used effectively.

CAVEATS

Ledger requires a good understanding of double-entry bookkeeping principles to utilize effectively. Data must be entered manually or imported using specialized tools.

JOURNAL FILE FORMAT

Ledger uses a plain text file format. Each transaction consists of a date, description, and a series of account postings, each with an amount and optional commodity. The format is whitespace-sensitive.

COMMODITIES

Ledger supports multiple commodities (currencies) and can automatically convert between them based on user-defined prices.
I.e. prices "2023/10/26 price USD 1.00 EUR"

EXPRESSIONS

Ledger's filtering and reporting can be based on Scheme expressions, allowing highly customized reports to be generated.

HISTORY

Ledger was originally developed by John Wiegley. It has become a popular tool for command-line accounting, known for its speed, flexibility, and powerful reporting capabilities. The project is actively maintained with contributions from a community of users.

SEE ALSO

awk(1), grep(1), sed(1)

Copied to clipboard