neulab/tldr huggingface dataset:
PSQL_EDITOR EDITOR VISUAL Editor used by the \e, \ef, and \ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.
PSQL_EDITOR_LINENUMBER_ARG When \e, \ef, or \ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi, this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples:
PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line '
The default is + on Unix systems (corresponding to the default editor vi, and useful for many other common editors); but there is no default on Windows systems.
PSQL_HISTORY Alternative location for the command history file. Tilde (~) expansion is performed.
PSQL_PAGER PAGER If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less. Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin.
PSQLRC Alternative location of the user's .psqlrc file. Tilde (~) expansion is performed.
SHELL Command executed by the \!  command.
TMPDIR Directory for storing temporary files. The default is /tmp.
psqlrc and ~/.psqlrc Unless it is passed an -X option, psql attempts to read and execute commands from the system-wide startup file (psqlrc) and then the user's personal startup file (~/.psqlrc), after connecting to the database but before accepting normal commands. These files can be used to set up the client and/or the server to taste, typically with \set and SET commands.
The system-wide startup file is named psqlrc and is sought in the installation's “system configuration” directory, which is most reliably identified by running pg_config --sysconfdir. By default this directory will be ../etc/ relative to the directory containing the PostgreSQL executables. The name of this directory can be set explicitly via the PGSYSCONFDIR environment variable.
The user's personal startup file is named .psqlrc and is sought in the invoking user's home directory. On Windows, which lacks such a concept, the personal startup file is named %APPDATA%\postgresql\psqlrc.conf. The location of the user's startup file can be set explicitly via the PSQLRC environment variable.
Both the system-wide startup file and the user's personal startup file can be made psql-version-specific by appending a dash and the PostgreSQL major or minor release number to the file name, for example ~/.psqlrc-9.2 or ~/.psqlrc-9.2.5. The most specific version-matching file will be read in preference to a non-version-specific file.
.psql_history The command-line history is stored in the file ~/.psql_history, or %APPDATA%\postgresql\psql_history on Windows.
The location of the history file can be set explicitly via the HISTFILE psql variable or the PSQL_HISTORY environment variable.
•   psql works best with servers of the same or an older major version. Backslash commands are particularly likely to fail if the server is of a newer version than psql itself. However, backslash commands of the \d family should work with servers of versions back to 7.4, though not necessarily with servers newer than psql itself. The general functionality of running SQL commands and displaying query results should also work with servers of a newer major version, but this cannot be guaranteed in all cases.
If you want to use psql to connect to several servers of different major versions, it is recommended that you use the newest version of psql. Alternatively, you can keep around a copy of psql from each major version and be sure to use the version that matches the respective server. But in practice, this additional complication should not be necessary.
•   Before PostgreSQL 9.6, the -c option implied -X (--no-psqlrc); this is no longer the case.
•   Before PostgreSQL 8.4, psql allowed the first argument of a single-letter backslash command to start directly after the command, without intervening whitespace. Now, some whitespace is required.
psql is built as a “console application”. Since the Windows console windows use a different encoding than the rest of the system, you must take special care when using 8-bit characters within psql. If psql detects a problematic console code page, it will warn you at startup. To change the console code page, two things are necessary:
•   Set the code page by entering cmd.exe /c chcp 1252. (1252 is a code page that is appropriate for German; replace it with your value.) If you are using Cygwin, you can put this command in /etc/profile.
•   Set the console font to Lucida Console, because the raster font does not work with the ANSI code page.
The first example shows how to spread a command over several lines of input. Notice the changing prompt:
testdb=> CREATE TABLE my_table ( testdb(>  first integer not null default 0, testdb(>  second text) testdb-> ; CREATE TABLE
Now look at the table definition again:
testdb=> \d my_table Table "public.my_table" Column |  Type   | Collation | Nullable | Default --------+---------+-----------+----------+--------- first  | integer |           | not null | 0 second | text    |           |          |
Now we change the prompt to something more interesting:
testdb=> \set PROMPT1 '%n@%m %~%R%# ' peter@localhost testdb=>
Let's assume you have filled the table with data and want to take a look at it:
peter@localhost testdb=> SELECT * FROM my_table; first | second -------+-------- 1 | one 2 | two 3 | three 4 | four (4 rows)
You can display tables in different ways by using the \pset command:
peter@localhost testdb=> \pset border 2 Border style is 2. peter@localhost testdb=> SELECT * FROM my_table; +-------+--------+ | first | second | +-------+--------+ |     1 | one    | |     2 | two    | |     3 | three  | |     4 | four   | +-------+--------+ (4 rows)
peter@localhost testdb=> \pset border 0 Border style is 0. peter@localhost testdb=> SELECT * FROM my_table; first second ----- ------ 1 one 2 two 3 three 4 four (4 rows)
peter@localhost testdb=> \pset border 1 Border style is 1. peter@localhost testdb=> \pset format csv Output format is csv. peter@localhost testdb=> \pset tuples_only Tuples only is on. peter@localhost testdb=> SELECT second, first FROM my_table; one,1 two,2 three,3 four,4 peter@localhost testdb=> \pset format unaligned Output format is unaligned. peter@localhost testdb=> \pset fieldsep '\t' Field separator is "    ". peter@localhost testdb=> SELECT second, first FROM my_table; one     1 two     2 three   3 four    4
Alternatively, use the short commands:
peter@localhost testdb=> \a \t \x Output format is aligned. Tuples only is off. Expanded display is on. peter@localhost testdb=> SELECT * FROM my_table; -[ RECORD 1 ]- first  | 1 second | one -[ RECORD 2 ]- first  | 2 second | two -[ RECORD 3 ]- first  | 3 second | three -[ RECORD 4 ]- first  | 4 second | four
Also, these output format options can be set for just one query by using \g:
peter@localhost testdb=> SELECT * FROM my_table peter@localhost testdb-> \g (format=aligned tuples_only=off expanded=on) -[ RECORD 1 ]- first  | 1 second | one -[ RECORD 2 ]- first  | 2 second | two -[ RECORD 3 ]- first  | 3 second | three -[ RECORD 4 ]- first  | 4 second | four
When suitable, query results can be shown in a crosstab representation with the \crosstabview command:
testdb=> SELECT first, second, first > 2 AS gt2 FROM my_table; first | second | gt2 -------+--------+----- 1 | one    | f 2 | two    | f 3 | three  | t 4 | four   | t (4 rows)
testdb=> \crosstabview first second first | one | two | three | four -------+-----+-----+-------+------ 1 | f   |     |       | 2 |     | f   |       | 3 |     |     | t     | 4 |     |     |       | t (4 rows)
This second example shows a multiplication table with rows sorted in reverse numerical order and columns with an independent, ascending numerical order.
testdb=> SELECT t1.first as "A", t2.first+100 AS "B", t1.first*(t2.first+100) as "AxB", testdb(> row_number() over(order by t2.first) AS ord testdb(> FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC testdb(> \crosstabview "A" "B" "AxB" ord A | 101 | 102 | 103 | 104 ---+-----+-----+-----+----- 4 | 404 | 408 | 412 | 416 3 | 303 | 306 | 309 | 312 2 | 202 | 204 | 206 | 208 1 | 101 | 102 | 103 | 104 (4 rows)
NCAT(1p)               User Contributed Perl Documentation              NCAT(1p)
ncat - Network Config Audit Tool for IOS (and other) configs
ncat [OPTIONS] config [config ...]
ncat reads a rules file (default /etc/ncat.conf) and checks one or more config files specified on the command line against rules found in the rules file.  Rules specify that a particular chunk of text is either required or forbidden.  Once all rules have been checked, a report is output listing violations.
There are some special features that apply if the file being checked is a CISCO IOS configuration. There are special rules (see below) that allow for parsing of per-interface and per-line configurations.
-r, --rules The "--rules" flag allows the specification of an alternate rules config file.
-l, --limitrulesto The "--limitrulesto" allows the commandline specification of a regular expression to limit the rules that are checked.  The name of the rule must match the regexp specified or the rule is skipped.  You might try something like
--limitrulesto=finger
--limitrulesto='finger\⎪syslog'
-c, --limitclassto The "--limitclassto" allows the command line specification of a regular expression to limit the rules that are checked.  The class of the rule must match the regexp specified or the rule is skipped.  You might try something like
--limitclassto=access --limitclassto=localrules --limitclassto=access,logging,aaa --limitclassto='access\⎪logging\⎪local.*'
See the rules file for definition of rule classes.  By default, only rules matching the class "default" are checked.  "all" is synonym for ".*".  You can give a "normal" comma separated list of classes that you want to check because "," is treated as a synonym for the regular expression or ("⎪").
-p, --onlypass The "--onlypass" flag indicates flag indicates that only passing rules should be reported.  It may not be combined with "--onlyfail"
-f, --onlyfail The "--onlyfail" flag indicates flag indicates that only failing rules should be reported.  It may not be combined with "--onlypass"
-V, --version The "--version" option displays the current program version.
The ncat config file or "rules file" (ncat.conf/ncat.conf.MASTER) contains four different types of information.  "Rules" define rules to be checked, "ConfigClass" specifies groups of optional rules, "ConfigLocal" specified local configuration value, and "ConfigGlobal" specifies global configuration options.
Rules Syntax
The rules file contains a series of records defining rules to be checked.  Each Record begins with "RuleName:..." field and continues until the next "RuleName:.."  field or end-of-file. Each record consists of a number of named fields.  The fields begin with an alphanumeric keyword followed by a colon and then a value.  Values may be continued across multiple lines by ending the line with a backslash (\).  The following is the list of valid field names and permissible values.
" RuleName:unique rule name RuleClass:class[,class...] RuleVersion:regular-expression RuleContext:(Global,IOSInterface,IOSLine) RuleType:(Required⎪Forbidden) RuleMatch:regular-expression [RuleInstance:regular-expression] [RuleImportance:number] [RuleDescription:Text...] [RuleFix:Text...]  "
* RuleName specifies a unique name for the rule.
* RuleClass specifies a class or classes to which the rule belongs.  Every rule is a member of the class "default" unless otherwise specified.   A rule can be a member of multiple classes.  The list of member classes is a comma separated list.
* RuleVersion specifies a pattern that indicates which config file version a rules applies to.
For example, if RuleVersion is "1[12].*" then the rule will apply to all IOS 11 and 12 configurations.
* RuleContext lists the context of the rule.  Possible values are
- Global - The rule must match anywhere in the config.
- IOSInterface - The rule must match in the context of an IOS interface definition
- IOSLine - The rule must match in the context of an IOS line definition.
* RuleType determines if the match should be required or forbidden
* RuleMatch specifies a regular expression to match within the given context.
* RuleInstance defines the instance of the rule that must match, for instance "Serial0/0","Vlan\d+","vty", or "aux".
* RuleImportance specifies a number indicating the relative importance of a rule.  The higher the number, the more important it is.
* RuleDescription contains a description/justification of the rule.
* RuleFix contains text to be applied to make the config "correct"
* regular-expression is a Perl regular expression
* rules and values enclosed in "[...]" are optional.
Rules Example
Here is an example of a rules file
RuleName:enable secret RuleClass:default,access RuleVersion:version 1[12]\.* RuleContext:Global RuleType:Required RuleMatch:enable secret \d \S+ RuleImportance:3 RuleDescription:Require enable secret.\ See rules.html#enablesecret for details. RuleFix:enable secret EDIT-BY-HAND
RuleName:Apply VTY ACL RuleClass:default,access RuleVersion:version 1[12]\.* RuleContext:IOSLine RuleInstance:vty RuleType:Required RuleMatch: access-class 92 in RuleImportance:2 RuleDescription:Require ACL 92 to be applied to VTYs\ See rules.html#ApplyVTYACL for details. RuleFix:\ line vty 0 4\ access-class 92 in\ exit
RuleName:no ip directed broadcast RuleClass:default,routing RuleVersion:version 11\.* RuleContext:IOSInterface RuleInstance:.* RuleType:Required RuleMatch:no ip directed-broadcast RuleImportance:2 RuleDescription:Disallow directed broadcasts by default.\ See rules.html#noipdirectedbroadcast for details. RuleFix:\ int INSTANCE\ no ip directed-broadcast\ exit
In the above example, the rules have the following meaning
Rule 1 requires a global (anywhere in the config) rule matching "enable secret" followed by a non-blank string.
Rule 2 requires that all vty lines have "access-class 92 in". It lists the commands that need to be entered to add the rule.
Rule 3 requires that all Vlan interfaces have "no ip directed broadcast" set and lists the commands needed to set it.  This rule applies only to IOS version 11.
Global Config Options Syntax and Example
In addition, there are several global rules file options:
" ConfigVersion:1.3 ConfigOrganization:My Organization ConfigDocumentType:Security Audit Rules ConfigPlatforms:Cisco IOS Routers ConfigFeedbackTo:me@my.org ConfigGuide:guide.pdf ConfigGuidePath:/usr/doc /usr/local/doc ~/doc ./doc ConfigRulesAlias:my-special-audit.html ConfigIntroText:Text (html)... ConfigTrailingText:Text (html)... ConfigOutputGroups:value [value ...] ConfigLineSkip:pattern[:pattern...]  "
* ConfigVersion defines the version number of the rules
* ConfigOrganziation describes the auditing organization
* ConfigDocumentType describes the type of document (e.g. "rules", "benchmark"...)
* ConfigPlatforms describes the type of systems being audited ("production routers...")
* ConfigFeedback lists contact info (e.g "me@some.place.org")
* ConfigGuide defines the name of a "configuration guide" to be symlinked into the directory where the audits are run.  This is useful because it allows the description portion of individual rules to make hyperlinks to a document containing a more complete justification for the rule.
* ConfigGuidePath defines the path to search for the guide.
* ConfigLineSkip defines a list of one or more patterns that causes checking to be skipped.  The default is "^ shutdown".
* ConfigRulesAlias defines an alias for the rules.html file.  A symlink from this name to "rules.html" will be created.
* ConfigIntroText defines text (HTML) to be inserted before the list of individual rules.
* ConfigTrailingText defines text (HTML) to be inserted after the list of individual rules.
* ConfigOutputGroups specifies groups (such as datacenter names) by which output is grouped in index.html.  The groups are space separated and are regular expressions.  The regular expressions are matched against the names of the configurations being checked.
These global rules file options are mostly used during report generation.
Local Configuration Options Syntax
ConfigLocal options allow the specification simple text substitution macros, i.e. a string that will be replaced with a given value.  The syntax is
" ConfigLocalName:KEY ConfigLocalValue:VALUE [ConfigLocalPrereqs:CLASS_NAME[,CLASS_NAME...]] [ConfigLocalDescription:COMMENT] "
* KEY is a keyword (e.g. "EternalInterface") that will be replaced by VALUE in the resulting config file.
* VALUE is a value ("Ethernet0") that will be substituted.
* CLASS_NAME is a list of one or more classes to which use the option
* COMMENT is a description of the option
* comments may be continued across several lines by ending each line to be continued with "\".
Local Configuration Options Example
Here is an example of a local configuration option:
ConfigLocalName:Local_Timezone ConfigLocalValue:GMT ConfigLocalClassPrereq:localtime ConfigLocalDescription:\ Specify the name of the timezone to be used.  For example, GMT,EST, etc.
In the above example, the fields have the following meaning
* ConfigLocalName specifies "Local_Timezone" as the name of the local option
* ConfigLocalValue specifies the value "GMT"
* ConfigLocalClassPrereq says that this option only applies if the class "localtime" is selected (this sets the "local" timezone to "GMT")
* ConfigLocalDescription specifies text to describe the option
Optional Rule Class Syntax
The master file may also contain ConfigClass: rules, which describe groups of configuration options.  ncat_config will prompt for inclusion/exclusion of classes ConfigClass: entries. They are of the form:
" ConfigClass:CLASS_NAME [ConfigClassConflictsWith:CLASS_NAME[,CLASS_NAME...]] [ConfigClassPrereq:CLASS_NAME[,CLASS_NAME...]] [ConfigClassDescription:COMMENT] . . .  "
* CLASS_NAME is the name of the rule class.  It should correspond to one rules having the same value for RuleClass.
* Comments may be continued across several lines by ending each line to be continued with "\".
* ConfigClassClassPrereq: is a comma-separated list of classes that are prerequisites of the class being defined
* ConfigClassConflictsWith: is a comma-separated list of classes that are incompatible with this class.
Optional Rule Class Example
Here is an example of a rule class:
ConfigClass:2nd_External_Interface ConfigClassPrereq:exterior_router ConfigClassDescription:\ Define a second external interface.
In this example
* ConfigClass specified the name of the config class as "2nd_External_Interface"
* ConfigClassPrereq says that this rule only applies of the ruleclass exterior_router is specified.
* ConfigClassDescription describes the purpose of the second ruleclass.
0  - success >0 - some error occurred
/etc/ncat.conf    - The rules file.
a config file - At least one config file on the command line (required)
Rules themselves may not contain colon (":") characters.
George M. Jones <gmj@users.sourceforge.net>
John Stewart has helped with the code in numerous ways.  It's much cleaner, and the install process is better thanks to his efforts.
Rob Thomas collected and wrote an excellent baseline IOS 12 secure configuration which is used as the basis for the example ncat.conf.  The first version of that config provided the "ah ha" insight that "config checking can be simple" and thus the impetus for the creation of this script.
Eric Brandwine has written a much more elegant and complete config checker.  Some of the features of this script are inspired by his work. In particular, the size and complexity of that program inspired the (at least initial) simplicity of this one.
Joshua Wright did the port for ActiveState on Windows.
LEDGER(1)                  BSD General Commands Manual                 LEDGER(1)
ledger — Command-line, double-entry account reporting tool
ledger [options] [command] [arguments]
ledger is a command-line accounting tool based on the power and completeness of double-entry accounting.  It is only a reporting tool, which means it never modifies your data files, but it does offer a large selection of reports, and different ways to customize them to your needs.
ledger accepts several top-level commands, each of which generates a different kind of basic report.  Most of them accept a report-query argument, in order to determine what should be reported.  To understand the syntax of a report-query, see the section on QUERIES.  In its most basic form, simply specifying one or more strings produces a report for all accounts containing those strings.
If no command is given, ledger enters a REPL, or command loop, allowing several commands to be executed on the same dataset without reparsing.
The following is a complete list of accepted reporting commands:
accounts [report-query] List all accounts for postings that match the report-query.
balance [report-query] Print a balance report showing totals for postings that match report-query, and aggregate totals for parents of those accounts. Options most commonly used with this command are: --basis (-B)     Report in terms of cost basis, not amount or value.  This is the only form of report which is guaranteed to always balance to zero, when no report-query is specified.  Only show totals for the top-most accounts. --empty (-E)     Show accounts whose total is zero. --flat           Rather than display a hierarchical tree, flatten the report to show subtotals for only accounts matching report-query. --no-total       Suppress the summary total shown at the bottom of the report.
The synonyms bal and b are also accepted.
budget [report-query] A special balance report which includes three extra columns: the amount budgeted during the reporting period, how spending differed from the budget, and the percentage of budget spent (exceeds 100% if you go over budget).  Note that budgeting requires one or more “periodic transactions” to be defined in your data file(s).  See the manual for more information.
cleared [report-query] A special balance report which adds two extra columns: the cleared balance for each account, and the date of the most recent cleared posting in that account.  For this accounting to be meaningful, the cleared flag must be set on at least one posting.  See the manual for more information.
commodities [report-query] List all commodities for postings matching the report-query.
convert  Reads data from a CSV (comma-separated values) file and generates ledger transactions.
csv [report-query] Report of postings matching the report-query in CSV format (comma- separated values).  Useful for exporting data to a spreadsheet for further analysis or charting.
entry [entry-template] Generate and display a new, properly formatted ledger transaction by comparing the entry-template to the transactions in your data file(s).  For more information on draft templates and using this command to quickly create new transactions, see the section ENTRIES.
The synonym xact is also accepted.
emacs [query] Output posting and transaction data in a format readily consumed by the Emacs editor, in a series of Lisp forms.  This is used by the Emacs ledger-mode to process reporting data from ledger.
equity [report-query] Print a transaction with a series of postings that balance current totals for accounts matching the report-query in a special account called Equity:Opening Balances.  The purpose of this report is to close the books for a prior year, while using these equity postings to carry forward those balances.
payees [report-query] List all payees for postings matching the report-query.
pricemap Produce a file which can be used to generate a graph with graphviz showing the relationship of commodities in the ledger file.
prices [report-query] Report prices for all commodities in postings matching the report-query.  The prices are reported with the granularity of a single day.
pricedb [report-query] Report prices for all commodities in postings matching the report-query.  Prices are reported down to the second, using the same format as the ~/.pricedb file.
print [report-query] Print out the full transactions of any matching postings using the same format as they would appear in a data file.  This can be used to extract subsets from a ledger file to transfer to other files.
push [options] In the REPL, push a set of command-line options, so that they will apply to all subsequent reports.
pop      In the REPL, pop any option settings that have been pushed.
register [report-query] List all postings matching the report-query.  This is one of the most common commands, and can be used to provide a variety of useful reports.  Options most commonly used with this command are:
--average (-A)   Show the running average, rather than a running total. --current (-c)   Don't show postings beyond the present day. --exchange commodity (-X) Render all values in the given commodity, if a price conversion rate can be determined.  Rates are always displayed relative to the date of the posting they are calculated for.  This means a register report is a historical value report. For current values, it may be preferable to use the balance report. --gain (-G)      Show any gains (or losses) in commodity values over time. --head number    Only show the top number postings. --historical (-H) Value commodities at the time of their acquisition. --invert         Invert the value of amounts shown. --market (-V)    Show current market values for all amounts.  This is determined in a somewhat magical fashion.  It is probably more straightforward to use --exchange option. --period time-period (-p) Show postings only for the given time-period. --related (-r)   Show postings that are related to those that would have been shown.  It has the effect of displaying the "other side" of the postings. --sort value-expression (-S) Sort postings by evaluating the given value-expression.  Note that a comma-separated list of expressions is allowed, in which case each sorting term is used in order to determine the final ordering.  For example, to search by date and then amount, one would use: ledger reg --sort 'date, amount' The sort order may be controlled with the '-' sign. For example, to sort in reverse chronological order: ledger reg --sort '-date' --tail number    Only show the last number postings. --uncleared (-U) Only show uncleared (i.e., recent) postings.
There are also several grouping options that can be useful:
--by-payee (-P)  Group postings by common payee names. --daily (-D)     Group postings by day. --weekly (-W)    Group postings by week (starting on Sundays). --start-of-week day Set the start of each report grouped by week to the given day. --monthly (-M)   Group postings by month. --quarterly      Group postings by fiscal quarter. --yearly (-Y)    Group postings by year. --days-of-week   Group postings by the day of the week on which they took place. --subtotal (-s)  Group all postings together.  This is very similar to the totals shown by the balance report.
The synonyms reg and r are also accepted.
server   This command requires that Python support be active.  If so, it starts up an HTTP server listening for requests on port 9000. This provides an alternate interface to creating and viewing reports.  Note that this is very much a work-in-progress, and will not be fully functional until a later version.
select [sql-query] List all postings matching the sql-query.  This command allows to generate SQL-like queries, e.g.: ledger select date,amount from posts where account=~/Income/
source   Parse a journal file and checks it for errors.  ledger will return success if no errors are found.
stats [report-query] Provide summary information about all the postings matching report-query.  It provides information such as: •   Time range of all matching postings •   Unique payees •   Unique accounts •   Postings total •   Uncleared postings •   Days since last posting •   Posts in the last 7 days •   Posts in the last 30 days •   Posts this month
xml [report-query] Output data relating to the current report in XML format.  It includes all accounts and commodities involved in the report, plus the postings and the transactions they are contained in.  See the manual for more information.
--abbrev-len INT Set the minimum length an account can be abbreviated to if it doesn't fit inside the account-width.  If INT is zero, then the account name will be truncated on the right.  If INT is greater than account-width then the account will be truncated on the left, with no shortening of the account names in order to fit into the desired width.
--account EXPR Prepend EXPR to all accounts reported.  That is, the option --account "'Personal'" would tack Personal: and --account "tag('VAT')" would tack the value of the VAT tag to the beginning of every account reported in a balance or register report.
--account-width INT Set the width of the account column in the register report to INT characters.
--actual (-L) Report only real transactions, with no automated or virtual transactions used.
--add-budget Show only un-budgeted postings.
--amount EXPR (-t) Apply the given value expression to the posting amount.  Using --amount EXPR you can apply an arbitrary transformation to the postings.
--amount-data (-j) On a register report print only the dates and amount of postings. Useful for graphing and spreadsheet applications.
--amount-width INT Set the width in characters of the amount column in the register report.
--anon   Anonymize registry output, mostly for sending in bug reports.
--ansi   Use color if the terminal supports it.  Alias for --color
--args-only Ignore init files and environment variables for the ledger run.
--auto-match When generating a ledger transaction from a CSV file using the convert command, automatically match an account from the Ledger journal.
--aux-date Show auxiliary dates for all calculations.  Alias for --effective
--average (-A) Print average values over the number of transactions instead of running totals.
--average-lot-prices Report the average price at which each commodity was purchased in a balance report.
--balance-format FMT Specify the format to use for the balance report.
--base   Reduce convertible commodities down the bottom of the conversion, e.g.  display time in seconds.
--basis (-B) Report the cost basis on all posting.  Alias for --cost
--begin DATE (-b) Specify the start DATE of all calculations.  Transactions before that date will be ignored.
--bold-if EXPR Print the entire line in bold if the given value expression is true.
--budget Only display budgeted items.  In a register report this displays transaction in the budget, in a balance report this displays accounts in the budget.
--budget-format FMT Specify the format to use for the budget report.
--by-payee (-P) Group postings in the register report by common payee names.
--check-payees Enable strict and pedantic checking for payees as well as accounts, commodities and tags.
--cleared (-C) Display only cleared postings.
--cleared-format FMT Specify the format to use for the cleared report
--collapse (-n) Print only the top level accounts.
--collapse-if-zero Collapse the account display only if it has a zero balance.
--color  Use color if the terminal supports it.  Alias for --ansi
--columns INT Make the register report INT characters wide.  By default ledger will use all available columns in your terminal.
--cost   Report the cost basis on all posting.  Alias for --basis.
--count  Direct ledger to report the number of items when appended to the commodities, accounts or payees commands.
--csv-format FMT Format csv report according to FMT.
--current (-c) Shorthand for --limit 'date <= today'.
--daily (-D) Shorthand for --period daily.
--date EXPR Transform the date of the transaction using EXPR.
--date-format DATEFMT (-y) Print dates using DATEFMT.  Refer to strftime(3) for details on the format string syntax.
--datetime-format DATETIMEFMT Print datetimes using DATETIMEFMT.  Refer to strftime(3) for details on the format string syntax.
--date-width INT Specify the width, in characters, of the date column in the register report.
--day-break Break up register report of timelog entries that span multiple days by day.
--days-of-week Group transactions by the days of the week.  Alias for --dow.
--dc     Display register or balance in debit/credit format If you use --dc with either the register or balance commands, you will now get separate columns for debits and credits.
--debug STR If ledger has been built with debug options this will provide extra data during the run.
--decimal-comma Direct ledger to parse journals using the European standard comma as decimal separator, vice a period.
--depth INT Limit the depth of the account tree.  In a balance report, for example, --depth 2 will print balances only for accounts with two levels, i.e.  Expenses:Entertainment but not Expenses:Entertainment:Dining.  This is a display predicate, which means it only affects display, not the total calculations.
--detail Related to convert command. Synonym to --rich-data option.
--deviation Report each posting's deviation from the average.  It is only meaningful in the register and prices reports.
--display EXPR (-d) Display lines that satisfy the expression EXPR.
--display-amount EXPR Apply a transformation to the displayed amount.  This occurs after calculations occur.
--display-total EXPR Apply a transformation to the displayed total.  This occurs after calculations occur.
--dow    Group transactions by the days of the week.  Alias for --days-of-week.
--download Cause quotes to be automagically downloaded, as needed, by running a script named getquote and expecting that script to return a value understood by ledger.  A sample implementation of a getquote script, implemented in Perl, is provided in the distribution. Downloaded quote price are then appended to the price database, usually specified using the environment variable LEDGER_PRICE_DB.
--effective Show auxiliary dates for all calculations.  Alias for --aux-date.
--empty (-E) Include empty accounts in report.
--end DATE (-e) Constrain the report so that transactions on or after DATE are not considered.
--equity Related to the equity command.  Gives current account balances in the form of a register report.
--exact  Report beginning and ending of periods by the date of the first and last posting occurring in that period.
--exchange COMMODITY [, COMMODITY, ...] (-X) Display values in terms of the given COMMODITY.  The latest available price is used.
--file FILE (-f) Read journal data from FILE.
--first INT Print the first INT entries.  Opposite of --last INT.  Alias for --head.
--flat   Force the full names of accounts to be used in the balance report. The balance report will not use an indented tree.
--force-color Output TTY color codes even if the TTY doesn't support them. Useful for TTYs that don't advertise their capabilities correctly.
--force-pager Force ledger to paginate its output.
--forecast-while EXPR Continue forecasting while VEXPR is true.  Alias for --forecast.
--forecast-years INT Forecast at most INT years into the future.
--format FMT (-F) Use the given format string FMT to print output.
--gain (-G) Report net gain or loss for commodities that have a price history.
--generated Include auto-generated postings (such as those from automated transactions) in the report, in cases where you normally wouldn't want them.
--group-by EXPR Group transaction together in the register report.  EXPR can be anything, although most common would be payee or commodity.  The tag() function is also useful here.
--group-title-format FMT Set the format for the headers that separate reports section of a grouped report.  Only has effect with a --group-by EXPR register report.
--head INT Print the first INT entries.  Opposite of --tail INT.  Alias for --first
--help   Print this man page.
--immediate Evaluate calculations immediately rather than lazily.
--import FILE Import FILE as Python module.
--init-file FILE (-i) Read FILE before any other ledger file.  This file may not contain any postings, but it may contain option settings.  To specify options in the init file, use the same syntax as the command-line, but put each option on its own line.
--inject STR Use STR amounts in calculations.  In case you know what amount a transaction should be, but the actual transaction has the wrong value you can use metadata STR to specify the expected amount.
--input-date-format DATEFMT Specify the input date format for journal entries.
--invert Change the sign of all reported values.
--last INT. Report only the last INT entries.  Opposite of --first INT.  Only useful on a register report.  Alias for --tail.
--leeway INT (-Z) Alias for --price-expr.
--limit EXPR (-l) Limit postings in calculations.
--lot-dates Report the date on which each commodity in a balance report was purchased.
--lot-notes Report the tag attached to each commodity in a balance report.
--lot-prices Report the price at which each commodity in a balance report was purchased.
--lots   Report the date and price at which each commodity was purchased in a balance report.
--lots-actual Preserve the uniqueness of commodities so they aren't merged during reporting without printing the lot annotations.
--market (-V) Use the latest market value for all commodities.
--master-account STR Prepend all account names with STR
--meta STR In the register report, prepend the transaction with the value of the given tag STR.
--meta-width INT Specify the width of the Meta column used for the --meta TAG options.
--monthly (-M) Shorthand for --period monthly.
--no-aliases Aliases are completely ignored.
--no-color Suppress any color TTY output.
--no-pager Disables the pager on TTY output.
--no-revalued Stop ledger from showing <Revalued> postings.
--no-rounding Don't output "<Adjustment>" postings.  Note that this will cause the running total to often not add up!  Its main use is for --amount-data (-j) and --total-data (-J) reports.
--no-titles Suppress the output of group titles.
--no-total Suppress printing the final total line in a balance report.
--now DATE Use DATE as the current date.  This affects the output when using --period, --begin, --end, or --current to decide which dates lie in the past or future.
--only EXPR This is a postings predicate that applies after certain transforms have been executed, such as periodic gathering.
--options Display the options in effect for this ledger invocation, along with their values and the source of those values.
--output FILE (-o) Redirect the output of ledger to FILE.
--pager STR Use STR as the pager program.
--payee  Sets a value expression for formatting the payee.  In the register report this prevents the second entry from having a date and payee for each transaction.
--payee-width INT Set the number of columns dedicated to the payee in the register report to INT.
--pedantic Accounts, tags or commodities not previously declared will cause errors.
--pending Use only postings that are marked pending.
--percent (-%) Calculate the percentage value of each account in a balance reports.  Only works for account that have a single commodity.
--period PERIOD (-p) Define a period expression that sets the time period during which transactions are to be accounted.  For a register report only the transactions that satisfy the period expression with be displayed. For a balance report only those transactions will be accounted in the final balances.
--period-sort Sort the posting within transactions using the given value expression.
--permissive Quiet balance assertions.
--pivot TAG Produce a balance pivot report "around" the given TAG.
--plot-amount-format FMT Define the output format for an amount data plot.
--plot-total-format FMT Define the output format for a total data plot.
--prepend-format FMT Prepend FMT to every line of the output.
--prepend-width INT Reserve INT spaces at the beginning of each line of the output.
--price (-I) Use the price of the commodity purchase for performing calculations.
--price-db FILE
--price-exp STR (-Z) Set the expected freshness of price quotes, in INT minutes.  That is, if the last known quote for any commodity is older than this value, and if --download is being used, then the Internet will be consulted again for a newer price.  Otherwise, the old price is still considered to be fresh enough.  Alias for --leeway.
--prices-format FMT Set the format for the prices report.
--pricedb-format FMT Set the format expected for the historical price file.
--primary-date Show primary dates for all calculations.  Alias for --actual-dates
--quantity (-O) Report commodity totals (this is the default).
--quarterly Shorthand for --period quarterly.
--raw    In the print report, show transactions using the exact same syntax as specified by the user in their data file.  Don't do any massaging or interpreting.  Can be useful for minor cleanups, like just aligning amounts.
--real (-R) Account using only real transactions ignoring virtual and automatic transactions.
--recursive-aliases Causes ledger to try to expand aliases recursively, i.e. try to expand the result of an earlier expansion again, until no more expansions apply.
--register-format FMT Define the output format for the register report.
--related (-r) In a register report show the related account.  This is the other side of the transaction.
--related-all Show all postings in a transaction, similar to --related but show both sides of each transaction.
--revalued Report discrepancy in values for manual reports by inserting <Revalued> postings.  This is implied when using the --exchange (-X) or --market (-V) option.
--revalued-only Show only <Revalued> postings.
--revalued-total Display the sum of the revalued postings as the running total, which serves to show unrealized capital in a gain/losses report.
--rich-data When generating a ledger transaction from a CSV file using the convert command, add CSV, Imported, and UUID meta-data.
--seed INT Set the random seed to INT for the generate command.  Used as part of development testing.
--script FILE Execute a ledger script.
--sort EXPR (-S) Sort the register report based on the value expression EXPR.
--sort-xacts Sort the posting within transactions using the given value expression.
--start-of-week STR Use STR as the particular day of the week to start when using the --weekly option.  STR can be day names, their abbreviations like "Mon", or the weekday number starting at 0 for Sunday.
--strict Accounts, tags or commodities not previously declared will cause warnings.
--subtotal (-s) Report register as a single subtotal.
--tail INT Report only the last INT entries.  Only useful on a register report.  Alias for --last INT
--time-colon Display the value for commodities based on seconds as hours and minutes.  Thus 8100s will be displayed as 2:15h instead of 2.25h.
--time-report Add two columns to the balance report to show the earliest checkin and checkout times for timelog entries.
--total EXPR (-T) Define a value expression used to calculate the total in reports.
--total-data (-J) Show only dates and totals to format the output for plots.
--total-width INT Set the width of the total field in the register report.
--trace INT Enable tracing.  The INT specifies the level of trace desired.
--truncate STR Indicates how truncation should happen when the contents of columns exceed their width.  Valid arguments for STR are leading, middle, and trailing.  The default is smarter than any of these three, as it considers sub-names within the account name (that style is called "abbreviate").
--unbudgeted Show only un-budgeted postings.
--uncleared (-U) Use only uncleared transactions in calculations and reports.
--unrealized Show generated unrealized gain and loss accounts in the balance report.
--unrealized-gains Allow the user to specify what account name should be used for unrealized gains.  Defaults to Equity:Unrealized Gains.  Often set in one's ~/.ledgerrc file to change the default.
--unrealized-losses Allow the user to specify what account name should be used for unrealized losses.  Defaults to Equity:Unrealized Losses.  Often set in one's ~/.ledgerrc file to change the default.
--unround Perform all calculations without rounding and display results to full precision.
--values Show the values used by each tag when used in combination with the tags command.
--value-expr EXPR Set a global value expression annotation.
--verbose Print detailed information on the execution of ledger.
--verify Enable additional assertions during run-time.  This causes a significant slowdown.  When combined with --debug CODE ledger will produce memory trace information.
--verify-memory Verify that every constructed object is properly destructed.  This is for debugging purposes only.
--weekly (-W) Shorthand for --period weekly.
--wide (-w) Assume 132 columns instead of the TTY width.
--yearly (-Y) Shorthand for --period yearly.
PRE-COMMANDS Pre-commands are useful when you aren't sure how a command or option will work.  The difference between a pre-command and a regular command is that pre-commands ignore the journal data file completely, nor is the user's init file read.
args / query Evaluate the given arguments and report how ledger interprets it against the following model transaction:
2004/05/27 Book Store ; This note applies to all postings. :SecondTag: Expenses:Books                 20 BOOK @ $10 ; Metadata: Some Value ; Typed:: $100 + $200 ; :ExampleTag: ; Here follows a note describing the posting. Liabilities:MasterCard        $-200.00
eval     Evaluate the given value expression against the model transaction.
format   Print details of how ledger uses the given formatting description and apply it against a model transaction.
parse / expr Print details of how ledger uses the given value expression description and apply it against a model transaction.
generate Randomly generates syntactically valid ledger data from a seed. Used by the GenerateTests harness for development testing.
period   Evaluate the given period and report how ledger interprets it.
template Shows the insertion template that the xact command generates. This is a debugging command.
The syntax for reporting queries can get somewhat complex.  It is a series of query terms with an implicit OR operator between them.  The following terms are accepted:
regex          A bare string is taken as a regular expression matching the full account name.  Thus, to report the current balance for all assets and liabilities, you would use:
ledger bal asset liab
payee regex (@regex) Query on the payee, rather than the account.
tag regex (%regex) Query on tags.
note regex (=regex) Query on anything found in an item's note.
code regex (#regex) Query on the xact's optional code (which can be any string the user wishes).
term and term  Query terms are joined by an implicit OR operator.  You can change this to AND by using the and keyword.  For example, to show food expenditures occurring at Shakee's Pizza, you could say:
ledger reg food and @Shakee
term or term   When you wish to be more explicit, use the OR operator.
not term       Reverse the logical meaning of the following term.  This can be used with parentheses to great effect:
ledger reg food and @Shakee and not dining
( term )       If you wish to mix OR and AND operators, it is often helpful to surround logical units with parentheses.  NOTE: Because of the way some shells interpret parentheses, you should always escape them:
ledger bal \( assets or liab \) and not food
abs(value)       Return the absolute value of the given value.
account          Return the posting's account.
account_base     Return the base account, i.e. everything after the last account delimiter ':'.
actual           Return true if the transaction is real, i.e not an automated or virtual transaction, false otherwise.
amount           Return the amount of the posting.
amount_expr      Return the calculated amount of the posting according to the --amount option.
ansify_if(value, color, bool) Render the given value as a string, applying the proper ANSI escape codes to display it in the given color if bool is true.  It typically checks the value of the option --color, for example: ansify_if(amount, blue, options.color)
beg_line         Line number where entry for posting begins.
beg_pos          Character position where entry for posting begins.