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       -t, --transform=XFM
47           Add a file transform; uses the 'transform' command syntax, e.g. "-t
48           'Fstab incl /etc/fstab.bak'".
49
50       -f, --file=FILE
51           Read commands from FILE.
52
53       -i, --interactive
54           Read commands from the terminal. When combined with -f or
55           redirection of stdin, drop into an interactive session after
56           executing the commands from the file.
57
58       -e, --echo
59           When reading commands from a file via stdin, echo the commands
60           before printing their output.
61
62       -s, --autosave
63           Automatically save all changes at the end of the session.
64
65       -S, --nostdinc
66           Do not search any of the default directories for modules. When this
67           option is set, only directories specified explicitly with -I or
68           specified in AUGEAS_LENS_LIB will be searched for modules.
69
70       -L, --noload
71           Do not load any files on startup. This is generally used to fine-
72           tune which files to load by modifying the entries in "/augeas/load"
73           and then issuing a "load" command.
74
75       -A, --noautoload
76           Do not load any lens modules, and therefore no files, on startup.
77           This creates no entries under "/augeas/load" whatsoever; to read
78           any files, they need to be set up manually and loading must be
79           initiated with a "load" command. Using this option gives the
80           fastest startup.
81
82       --span
83           Load span positions for nodes in the tree, as they relate to the
84           original file. Enables the use of the span command to retrieve
85           position data.
86
87       --version
88           Print version information and exit. The version is also in the tree
89           under "/augeas/version".
90

COMMANDS

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

ENVIRONMENT VARIABLES

248       AUGEAS_ROOT
249           The file system root, defaults to '/'. Can be overridden with the
250           -r command line option
251
252       AUGEAS_LENS_LIB
253           Colon separated list of directories with lenses. Directories
254           specified here are searched after any directories set with the -I
255           command line option, but before the default directories
256           /usr/share/augeas/lenses and /usr/share/augeas/lenses/dist
257

DIAGNOSTICS

259       Normally, exit status is 0. If one or more commands fail, the exit
260       status is set to a non-zero value.
261
262       Note though that failure to load some of the files specified by
263       transforms in "/augeas/load" is not considered a failure. If it is
264       important to know that all files were loaded, you need to issue a
265       "match /augeas//error" after loading to find out details about what
266       files could not be loaded and why.
267

EXAMPLES

269         # command line mode
270         augtool print /files/etc/hosts/
271
272         # interactive mode
273         augtool
274         augtool> help
275         augtool> print /files/etc/hosts/
276
277         # Print the third entry from the second AcceptEnv line
278         augtool print '/files/etc/ssh/sshd_config/AcceptEnv[2]/3'
279
280         # Find the entry in inittab with action 'initdefault'
281         augtool> match /files/etc/inittab/*/action initdefault
282
283         # Print the last alias for each entry in /etc/hosts
284         augtool> print /files/etc/hosts/*/alias[last()]
285

FILES

287       Lenses and schema definitions in /usr/share/augeas/lenses and
288       /usr/share/augeas/lenses/dist
289

AUTHOR

291         David Lutterkort <dlutter@redhat.com>
292
294       Copyright 2007-2012 Red Hat Inc.
295
296       Augeas (and augtool) are distributed under the GNU Lesser General
297       Public License (LGPL)
298

SEE ALSO

300       Augeas project homepage <http://www.augeas.net/>
301
302       augparse
303
304
305
306Augeas 1.2.0                      2014-06-04                        AUGTOOL(1)
Impressum