/usr/share/doc/ledger/ledger.html/Commands.html is in ledger 2.6.2-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | <html lang="en">
<head>
<title>Commands - Ledger: Command-Line Accounting</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Ledger: Command-Line Accounting">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Running-Ledger.html#Running-Ledger" title="Running Ledger">
<link rel="prev" href="Usage-overview.html#Usage-overview" title="Usage overview">
<link rel="next" href="Options.html#Options" title="Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (c) 2003-2009, John Wiegley. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of New Artisans LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Commands"></a>
<p>
Next: <a rel="next" accesskey="n" href="Options.html#Options">Options</a>,
Previous: <a rel="previous" accesskey="p" href="Usage-overview.html#Usage-overview">Usage overview</a>,
Up: <a rel="up" accesskey="u" href="Running-Ledger.html#Running-Ledger">Running Ledger</a>
<hr>
</div>
<h3 class="section">2.2 Commands</h3>
<h4 class="subsection">2.2.1 balance</h4>
<p>The <samp><span class="command">balance</span></samp> command reports the current balance of all
accounts. It accepts a list of optional regexps, which confine the
balance report to the matching accounts. If an account contains
multiple types of commodities, each commodity's total is reported
separately.
<h4 class="subsection">2.2.2 register</h4>
<p>The <samp><span class="command">register</span></samp> command displays all the transactions occurring
in a single account, line by line. The account regexp must be
specified as the only argument to this command. If any regexps occur
after the required account name, the register will contain only those
transactions that match. Very useful for hunting down a particular
transaction.
<p>The output from <samp><span class="command">register</span></samp> is very close to what a typical
checkbook, or single-account ledger, would look like. It also shows a
running balance. The final running balance of any register should
always be the same as the current balance of that account.
<p>If you have Gnuplot installed, you may plot the amount or running
total of any register by using the script <samp><span class="file">report</span></samp>, which is
included in the Ledger distribution. The only requirement is that you
add either <samp><span class="option">-j</span></samp> or <samp><span class="option">-J</span></samp> to your register command, in
order to plot either the amount or total column, respectively.
<h4 class="subsection">2.2.3 print</h4>
<p>The <samp><span class="command">print</span></samp> command prints out ledger entries in a textual
format that can be parsed by Ledger. They will be properly formatted,
and output in the most economic form possible. The “print” command
also takes a list of optional regexps, which will cause only those
transactions which match in some way to be printed.
<p>The <samp><span class="command">print</span></samp> command can be a handy way to clean up a ledger
file whose formatting has gotten out of hand.
<h4 class="subsection">2.2.4 output</h4>
<p>The <samp><span class="command">output</span></samp> command is very similar to the <samp><span class="command">print</span></samp>
command, except that it attempts to replicate the specified ledger
file exactly. The format of the command is:
<pre class="example"> ledger -f FILENAME output FILENAME
</pre>
<p>Where <samp><span class="file">FILENAME</span></samp> is the name of the ledger file to output. The
reason for specifying this command is that only entries contained
within that file will be output, and not an included entries (as can
happen with the <samp><span class="command">print</span></samp> command).
<h4 class="subsection">2.2.5 xml</h4>
<p>The <samp><span class="command">xml</span></samp> command outputs results similar to what
<samp><span class="command">print</span></samp> and <samp><span class="command">register</span></samp> display, but as an XML form.
This data can then be read in and processed. Use the
<samp><span class="option">--totals</span></samp> option to include the running total with each
transaction.
<h4 class="subsection">2.2.6 emacs</h4>
<p>The <samp><span class="command">emacs</span></samp> command outputs results in a form that can be read
directly by Emacs Lisp. The format of the sexp is:
<pre class="example"> ((BEG-POS CLEARED DATE CODE PAYEE
(ACCOUNT AMOUNT)...) ; list of transactions
...) ; list of entries
</pre>
<h4 class="subsection">2.2.7 equity</h4>
<p>The <samp><span class="command">equity</span></samp> command prints out accounts balances as if they
were entries. This makes it easy to establish the starting balances
for an account, such as when <a href="Archiving-previous-years.html#Archiving-previous-years">Archiving previous years</a>.
<h4 class="subsection">2.2.8 prices</h4>
<p>The <samp><span class="command">prices</span></samp> command displays the price history for matching
commodities. The <samp><span class="option">-A</span></samp> flag is useful with this report, to
display the running average price, or <samp><span class="option">-D</span></samp> to show each price's
deviation from that average.
<p>There is also a <samp><span class="command">pricesdb</span></samp> command which outputs the same
information as <samp><span class="command">prices</span></samp>, but does in a format that can be
parsed by Ledger.
<h4 class="subsection">2.2.9 entry</h4>
<p>The <samp><span class="command">entry</span></samp> commands simplifies the creation of new entries.
It works on the principle that 80% of all transactions are variants of
earlier transactions. Here's how it works:
<p>Say you currently have this transaction in your ledger file:
<pre class="smallexample"> 2004/03/15 * Viva Italiano
Expenses:Food $12.45
Expenses:Tips $2.55
Liabilities:MasterCard $-15.00
</pre>
<p>Now it's ‘<samp><span class="samp">2004/4/9</span></samp>’, and you've just eating at ‘<samp><span class="samp">Viva
Italiano</span></samp>’ again. The exact amounts are different, but the overall
form is the same. With the <samp><span class="command">entry</span></samp> command you can type:
<pre class="example"> ledger entry 2004/4/9 viva food 11 tips 2.50
</pre>
<p>This produces the following output:
<pre class="smallexample"> 2004/04/09 Viva Italiano
Expenses:Food $11.00
Expenses:Tips $2.50
Liabilities:MasterCard $-13.50
</pre>
<p>It works by finding a past transaction matching the regular expression
‘<samp><span class="samp">viva</span></samp>’, and assuming that any accounts or amounts specified will
be similar to that earlier transaction. If Ledger does not succeed in
generating a new entry, an error is printed and the exit code is set
to ‘<samp><span class="samp">1</span></samp>’.
<p>There is a shell script in the distribution's <samp><span class="file">scripts</span></samp> directory
called <samp><span class="file">entry</span></samp>, which simplifies the task of adding a new entry
to your ledger. It launches <samp><span class="command">vi</span></samp> to confirm that the entry
looks appropriate.
<p>Here are a few more examples of the <samp><span class="command">entry</span></samp> command, assuming
the above journal entry:
<pre class="example"> ledger entry 4/9 viva 11.50
ledger entry 4/9 viva 11.50 checking # (from `checking')
ledger entry 4/9 viva food 11.50 tips 8
ledger entry 4/9 viva food 11.50 tips 8 cash
ledger entry 4/9 viva food $11.50 tips $8 cash
ledger entry 4/9 viva dining "DM 11.50"
</pre>
</body></html>
|