OWolf

AboutBlogProjects
Β©2025 OWolf.com

Privacy

Contact

accounting

Ledger CLI A Beginner's Tutorial

July 31, 2025

O. Wolfson

🧾 Ledger CLI: A Beginner’s Tutorial

Track your money using plain text files and the command line!


πŸ“¦ Step 1: Install Ledger CLI

Mac (with Homebrew):

bash
brew install ledger

Linux (Debian/Ubuntu):

bash
sudo apt install ledger

Windows:

  • Use WSL or download from https://ledger-cli.org

πŸ“ Step 2: Create a .ledger File

Create a plain text file called my.ledger:

bash
touch my.ledger

Then open it in your favorite editor (VS Code, Vim, etc).


✍️ Step 3: Add Your First Transaction

Paste this into my.ledger:

ledger
2025/07/22 Bought groceries
    Expenses:Groceries         $50.00
    Assets:Bank:Checking      -$50.00

This means:

  • You spent $50 on groceries
  • The money came from your bank account

πŸ“Š Step 4: See Your Account Balances

In the terminal, run:

bash
ledger -f my.ledger balance

Output:

           $50.00  Expenses:Groceries
          -$50.00  Assets:Bank:Checking
--------------------
                   0

βž• Step 5: Add More Transactions

Append more entries like:

ledger
2025/07/23 Freelance income
    Assets:Bank:Checking      $500.00
    Income:Freelance         -$500.00

2025/07/24 Rent payment
    Expenses:Housing:Rent     $700.00
    Assets:Bank:Checking     -$700.00

Then run:

bash
ledger -f my.ledger register

To see a checkbook-style ledger.


πŸ”Ž Step 6: Filter by Account

bash
ledger -f my.ledger register Expenses

Or:

bash
ledger -f my.ledger balance Income

🧠 Bonus Tips

  • Transactions must balance to zero
  • Indent all account lines with spaces, not tabs
  • Use ; for comments

Example with a comment:

ledger
2025/07/25 Coffee at cafe
    Expenses:Food:Coffee      $3.50   ; morning espresso
    Assets:Cash              -$3.50

βœ… Next Steps

  • Try splitting an expense (e.g. part business, part personal)
  • Create your own categories like Expenses:Business:Marketing
  • Add Income:Property:Rent, Expenses:Health:Insurance, etc.

πŸ“š Resources

  • Official site: https://ledger-cli.org
  • Cheatsheet: https://plaintextaccounting.org
  • Book: Ledger CLI Pocket Reference