Skip to content

Instantly share code, notes, and snippets.

@agarrharr
Last active December 27, 2023 18:18
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save agarrharr/03450c1be7f6b3d2b883c6b5e317d2aa to your computer and use it in GitHub Desktop.
Save agarrharr/03450c1be7f6b3d2b883c6b5e317d2aa to your computer and use it in GitHub Desktop.
Common Ledger CLI Commands

Common Ledger CLI Commands

  • Income vs expenses this month?

    $ ledger balance income expenses --period "this month"
  • What did my budget look like at a certain date?

    $ ledger balance budget --end 2018-01-02

    This is how it looked at the end of the day on Jan 1, 2018.

  • How much is in the checking account right now?

    $ ledger balance checking
  • What is our net worth?

    $ ledger balance ^assets ^liabilities --real
  • How much money have we made?

    $ ledger balance income
  • How much money have we made from our salaries?

    $ ledger balance income:salary
  • How much do we spend each month on x?

    $ ledger register -M expenses:groceries:food
  • Group transactions by payee

    $ ledger register --by-payee
  • Only show uncleared transactions

    $ ledger register --uncleared
  • Do I have enough budgeted to pay off my credit cards?

    $ ledger balance creditcard

    It should be $0.00. If it's not $0.00, run this with different dates to find the problem:

    $ ledger balance creditcard --end 2018-02-01
  • Import

    Change Chase checking from:

    Details,Posting Date,Description,Amount,Type,Balance,Check or Slip #
    

    to:

    ,Date,Payee,Amount,,,Code
    

    Change Chase Credit Card from:

    Type,Trans Date,Post Date,Description,Amount
    

    to:

    ,Date,Posted,Payee,Amount
    
    $ ledger convert ~/Downloads/checking.CSV --input-date-format "%m/%d/%Y" --invert --account Assets:Checking --rich-data -f budget.ledger --auto-match --pager less
  • Expenses each month (sorted)

    $ ledger -M --period-sort "(amount)" reg ^expenses

    This will show all expenses, grouped by month and sorted by the amount.

  • How much do we spend on credit cards each month?

    $ ledger -M -r --display 'account=~/creditcard/' reg ^expenses
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment