| 1 |
accounts |
| 2 |
|
| 3 |
List the account names used or declared in the journal. |
| 4 |
|
| 5 |
Flags: |
| 6 |
-u --used list accounts used |
| 7 |
-d --declared list accounts declared |
| 8 |
--undeclared list accounts used but not declared |
| 9 |
--unused list accounts declared but not used |
| 10 |
--find list the first account matched by the first |
| 11 |
argument (a case-insensitive infix regexp) |
| 12 |
--directives show as account directives, for use in journals |
| 13 |
--locations also show where accounts were declared |
| 14 |
--types also show account types when known |
| 15 |
-l --flat list/tree mode: show accounts as a flat list |
| 16 |
(default) |
| 17 |
-t --tree list/tree mode: show accounts as a tree |
| 18 |
--drop=N flat mode: omit N leading account name parts |
| 19 |
|
| 20 |
This command lists account names - all of them by default, or just the |
| 21 |
ones which have been used in transactions (-u/--used), or declared with |
| 22 |
account directives (-d/--declared), or used but not declared |
| 23 |
(--undeclared), or declared but not used (--unused), or just the first |
| 24 |
one matched by a pattern (--find, returning a non-zero exit code if it |
| 25 |
fails). |
| 26 |
|
| 27 |
You can add query arguments to select a subset of transactions or |
| 28 |
accounts. |
| 29 |
|
| 30 |
With --directives, it shows valid account directives which could be |
| 31 |
pasted into a journal file. This is useful together with --undeclared |
| 32 |
when updating your account declarations to satisfy |
| 33 |
hledger check accounts. |
| 34 |
|
| 35 |
With --locations, it also shows the file and line number of each |
| 36 |
account's declaration, if any, and the account's overall declaration |
| 37 |
order; these may be useful when troubleshooting account display order. |
| 38 |
|
| 39 |
With --types, it also shows each account's type, if it's known. (See |
| 40 |
Declaring accounts > Account types.) |
| 41 |
|
| 42 |
It shows a flat list by default. With --tree, it uses indentation to |
| 43 |
show the account hierarchy. In flat mode you can add --drop N to omit |
| 44 |
the first few account name components. Account names can be |
| 45 |
depth-clipped with depth:N or --depth N or -N. |
| 46 |
|
| 47 |
Examples: |
| 48 |
|
| 49 |
$ hledger accounts |
| 50 |
assets:bank:checking |
| 51 |
assets:bank:saving |
| 52 |
assets:cash |
| 53 |
expenses:food |
| 54 |
expenses:supplies |
| 55 |
income:gifts |
| 56 |
income:salary |
| 57 |
liabilities:debts |
| 58 |
|
| 59 |
$ hledger accounts --undeclared --directives >> $LEDGER_FILE |
| 60 |
$ hledger check accounts |