1AUGTOOL(1)                          Augeas                          AUGTOOL(1)
2
3
4

NAME

6       augtool - inspect and modify configuration files
7

SYNOPSIS

9       augtool [OPTIONS] [COMMAND]
10

DESCRIPTION

12       Augeas is a configuration editing tool. It parses configuration files
13       in their native formats and transforms them into a tree. Configuration
14       changes are made by manipulating this tree and saving it back into
15       native config files.
16
17       augtool provides a command line interface to the generated tree.
18       COMMAND can be a single command as described under "COMMANDS". When
19       called with no COMMAND, it reads commands from standard input until an
20       end-of-file is encountered.
21

OPTIONS

23       -c, --typecheck
24           Typecheck lenses. This can be very slow, and is therefore not done
25           by default, but is highly recommended during development.
26
27       -b, --backup
28           When files are changed, preserve the originals in a file with
29           extension '.augsave'
30
31       -n, --new
32           Save changes in files with extension '.augnew', do not modify the
33           original files
34
35       -r, --root=ROOT
36           Use directory ROOT as the root of the filesystem. Takes precedence
37           over a root set with the AUGEAS_ROOT environment variable.
38
39       -I, --include=DIR
40           Add DIR to the module loadpath. Can be given multiple times. The
41           directories set here are searched before any directories specified
42           in the AUGEAS_LENS_LIB environment variable, and before the default
43           directories /usr/share/augeas/lenses and
44           /usr/share/augeas/lenses/dist.
45
46       -f, --file=FILE
47           Read commands from FILE.
48
49       -i, --interactive
50           Read commands from the terminal. When combined with -f or
51           redirection of stdin, drop into an interactive session after
52           executing the commands from the file.
53
54       -e  When reading commands from a file via stdin, echo the commands
55           before printing their output.
56
57       -s, --autosave
58           Automatically save all changes at the end of the session.
59
60       -S, --nostdinc
61           Do not search any of the default directories for modules. When this
62           option is set, only directories specified explicitly with -I or
63           specified in AUGEAS_LENS_LIB will be searched for modules.
64
65       -L, --noload
66           Do not load any files on startup. This is generally used to fine-
67           tune which files to load by modifying the entries in "/augeas/load"
68           and then issuing a "load" command.
69
70       -A, --noautoload
71           Do not load any lens modules, and therefore no files, on startup.
72           This creates no entries under "/augeas/load" whatsoever; to read
73           any files, they need to be set up manually and loading must be
74           initiated with a "load" command. Using this option gives the
75           fastest startup.
76
77       --span
78           Load span positions for nodes in the tree, as they relate to the
79           original file. Enables the use of the span command to retrieve
80           position data.
81
82       --version
83           Print version information and exit. The version is also in the tree
84           under "/augeas/version".
85

COMMANDS

87       In interactive mode, commands and paths can be completed by pressing
88       "TAB".
89
90       The paths accepted as arguments by commands use a small subset of XPath
91       path expressions. A path expression consists of a number of segments,
92       separated by "/". In each segment, the character "*" can be used to
93       match every node regardless of its label. Sibling nodes with identical
94       labels can be distinguished by appending "[N]" to their label to match
95       the N-th sibling with such a label. The last sibling with a specific
96       label can be reached as "[last()]". See "EXAMPLES" for some examples of
97       this.
98
99   ADMIN COMMANDS
100       The following commands control the behavior of Augeas and augtool
101       itself.
102
103       help
104           Print this help text
105
106       load
107           Load files according to the transforms in "/augeas/load".
108
109       quit
110           Exit the program
111
112       retrieve <LENS> <NODE_IN> <PATH> <NODE_OUT>
113           Transform tree at PATH back into text using lens LENS and store the
114           resulting string at NODE_OUT. Assume that the tree was initially
115           read in with the same lens and the string stored at NODE_IN as
116           input.
117
118       save
119           Save all pending changes to disk. Unless either the -b or -n
120           command line options are given, files are changed in place.
121
122       store <LENS> <NODE> <PATH>
123           Parse NODE using LENS and store the resulting tree at PATH.
124
125       transform <LENS> <FILTER> <FILE>
126           Add a transform for FILE using LENS. The LENS may be a module name
127           or a full lens name.  If a module name is given, then "lns" will be
128           the lens assumed.  The FILTER must be either "incl" or "excl".  If
129           the filter is "incl",  the FILE will be parsed by the LENS.  If the
130           filter is "excl", the FILE will be excluded from the LENS. FILE may
131           contain wildcards.
132
133   READ COMMANDS
134       The following commands are used to retrieve data from the Augeas tree.
135
136       dump-xml [<PATH>]
137           Print entries in the tree as XML. If PATH is given, printing starts
138           there, otherwise the whole tree is printed.
139
140       get <PATH>
141           Print the value associated with PATH
142
143       label <PATH>
144           Get and print the label associated with PATH
145
146       ls <PATH>
147           List the direct children of PATH
148
149       match <PATTERN> [<VALUE>]
150           Find all paths that match PATTERN. If VALUE is given, only the
151           matching paths whose value equals VALUE are printed
152
153       print [<PATH>]
154           Print entries in the tree. If PATH is given, printing starts there,
155           otherwise the whole tree is printed
156
157       span <PATH>
158           Print the name of the file from which the node PATH was generated,
159           as well as information about the positions in the file
160           corresponding to the label, the value, and the entire node. PATH
161           must match exactly one node.
162
163           You need to run 'set /augeas/span enable' prior to loading files to
164           enable recording of span information. It is disabled by default.
165
166   WRITE COMMANDS
167       The following commands are used to modify the Augeas tree.
168
169       clear <PATH>
170           Set the value for PATH to NULL. If PATH is not in the tree yet, it
171           and all its ancestors will be created.
172
173       clearm <BASE> <SUB>
174           Clear multiple nodes values in one operation. Find or create a node
175           matching SUB by interpreting SUB as a path expression relative to
176           each node matching BASE. If SUB is '.', the nodes matching BASE
177           will be modified.
178
179       ins <LABEL> <WHERE> <PATH>
180           Insert a new node with label LABEL right before or after PATH into
181           the tree. WHERE must be either 'before' or 'after'.
182
183       insert <LABEL> <WHERE> <PATH>
184           Alias of ins.
185
186       mv <SRC> <DST>
187           Move node SRC to DST. SRC must match exactly one node in the tree.
188           DST must either match exactly one node in the tree, or may not
189           exist yet. If DST exists already, it and all its descendants are
190           deleted. If DST does not exist yet, it and all its missing
191           ancestors are created.
192
193       move <SRC> <DST>
194           Alias of mv.
195
196       rename <SRC> <LBL>
197           Rename the label of all nodes matching SRC to LBL.
198
199       rm <PATH>
200           Delete PATH and all its children from the tree
201
202       set <PATH> <VALUE>
203           Associate VALUE with PATH. If PATH is not in the tree yet, it and
204           all its ancestors will be created.
205
206       setm <BASE> <SUB> [<VALUE>]
207           Set multiple nodes in one operation.  Find or create a node
208           matching SUB by interpreting SUB as a path expression relative to
209           each node matching BASE. If SUB is '.', the nodes matching BASE
210           will be modified.
211
212       touch <PATH>
213           Create PATH with the value NULL if it is not in the tree yet.  All
214           its ancestors will also be created.  These new tree entries will
215           appear last amongst their siblings.
216
217   PATH EXPRESSION COMMANDS
218       The following commands help when working with path expressions.
219
220       defnode <NAME> <EXPR> [<VALUE>]
221           Define the variable NAME to the result of evaluating EXPR, which
222           must be a nodeset. If no node matching EXPR exists yet, one is
223           created and NAME will refer to it. If VALUE is given, this is the
224           same as 'set EXPR VALUE'; if VALUE is not given, the node is
225           created as if with 'clear EXPR' would and NAME refers to that node.
226
227       defvar <NAME> <EXPR>
228           Define the variable NAME to the result of evaluating EXPR. The
229           variable can be used in path expressions as $NAME. Note that EXPR
230           is evaluated when the variable is defined, not when it is used.
231

ENVIRONMENT VARIABLES

233       AUGEAS_ROOT
234           The file system root, defaults to '/'. Can be overridden with the
235           -r command line option
236
237       AUGEAS_LENS_LIB
238           Colon separated list of directories with lenses. Directories
239           specified here are searched after any directories set with the -I
240           command line option, but before the default directories
241           /usr/share/augeas/lenses and /usr/share/augeas/lenses/dist
242

DIAGNOSTICS

244       Normally, exit status is 0. If one or more commands fail, the exit
245       status is set to a non-zero value.
246
247       Note though that failure to load some of the files specified by
248       transforms in "/augeas/load" is not considered a failure. If it is
249       important to know that all files were loaded, you need to issue a
250       "match /augeas//error" after loading to find out details about what
251       files could not be loaded and why.
252

EXAMPLES

254         # command line mode
255         augtool print /files/etc/hosts/
256
257         # interactive mode
258         augtool
259         augtool> help
260         augtool> print /files/etc/hosts/
261
262         # Print the third entry from the second AcceptEnv line
263         augtool print '/files/etc/ssh/sshd_config/AcceptEnv[2]/3'
264
265         # Find the entry in inittab with action 'initdefault'
266         augtool> match /files/etc/inittab/*/action initdefault
267
268         # Print the last alias for each entry in /etc/hosts
269         augtool> print /files/etc/hosts/*/alias[last()]
270

FILES

272       Lenses and schema definitions in /usr/share/augeas/lenses and
273       /usr/share/augeas/lenses/dist
274

AUTHOR

276         David Lutterkort <dlutter@redhat.com>
277
279       Copyright 2007-2012 Red Hat Inc.
280
281       Augeas (and augtool) are distributed under the GNU Lesser General
282       Public License (LGPL)
283

SEE ALSO

285       Augeas project homepage <http://www.augeas.net/>
286
287       augparse
288
289
290
291Augeas 1.0.0                      2014-06-13                        AUGTOOL(1)
Impressum