Faster CLI with hledger

In this week's hledger fan blog posting, I show one of my favorite tricks for saving time at the command line. Read about it at

1 Like

I just make just commands for things that I use periodically. just + hledger = :heart:


This isn't hledger specific though. I do this in ledger as well

Even better, you can use regex for those three letter combos. The most popular are ^start_match and end_match$; but nothing stops you from using other detailed regex — see this example from the Ledger docs

Another thing I find quite useful is shell aliases for common commands, like (for hledger):

alias hl='hledger'
alias acc='hledger accounts'
alias accounts='hledger accounts'
alias act='hledger activity'
alias add='hledger add'
alias areg='hledger aregister'
alias bal='hledger balance'
alias bs='hledger bs'
alias bse='hledger bse'
alias budget='hledger bal --budget'
alias cf='hledger cashflow'
alias check='hledger check'
alias close='hledger close'
alias comm='hledger commodities'
alias desc='hledger descriptions'
alias files='hledger files'
alias iadd='hledger-iadd'
alias is='hledger is'
alias notes='hledger notes'
alias payees='hledger payees'
alias prices='hledger prices'
alias print='hledger print'
alias reg='hledger register'
alias stats='hledger stats'
alias tags='hledger tags'

alias all='hledger -f $FINDIR/all.journal'
alias 2020='hledger -f $FINDIR/2020/2020.journal'
alias 2021='hledger -f $FINDIR/2021/2021.journal'
alias 2022='hledger -f $FINDIR/2022/2022.journal'
alias 2023='hledger -f $FINDIR/2023/2023.journal'
alias 2024='hledger -f $FINDIR/2024/2024.journal'


1 Like

The "just" commands are new to me. Can you give an example or two of what one of these commands would look like with your favorite plain text accounting tool?

Yes, regular expressions can be powerful and timesaving. I always feel that I need to learn more about them.

Very helpful examples, and as I was following your link, I also came across the justfile examples in Worth noting for me in case I want to start using "just" commands.

Related: hledger and just - hledger

1 Like

Wow, just looks like a great program. I'll have to check it out. At first look, I thought it was like pet, but pet's more general-use. I've saved hedger commands there before, but I'll give just a try.